35252-medium-isalphabet

Back

type IsAlphabet<S extends string> = Uppercase<S> extends Lowercase<S> ? false : true;

Solution by E-uler #35336

type IsAlphabet<S extends string> = Lowercase<S> extends Uppercase<S> ? false : true

Solution by DevilTea #35312

type IsAlphabet<S extends string> = Uppercase<S> extends Lowercase<S> ? false : true

Playground

type IsAlphabet<S extends string> = (
  & Record<`${any}${S & `${any}${any}`}${any}`, true>
  & Record<string, false>
)['ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'];

Playground

Solution by teamchong #35257