Skip to content

Instantly share code, notes, and snippets.

@vid3v
Created March 16, 2022 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vid3v/6a9b46a5393713cdc7c7b318bdf65c18 to your computer and use it in GitHub Desktop.
Save vid3v/6a9b46a5393713cdc7c7b318bdf65c18 to your computer and use it in GitHub Desktop.
export type CamelCase<S extends string> = S extends ``
? S
: S extends `${infer F}${' '| '_' | '-'}${infer L}`
? `${CamelCase<Lowercase<F>>}${Capitalize<CamelCase<L>>}`
: Lowercase<S>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment