sindresorhus / type-fest

A collection of essential TypeScript types
Creative Commons Zero v1.0 Universal
14.36k stars 546 forks source link

Enforce Casing #793

Open douglasg14b opened 10 months ago

douglasg14b commented 10 months ago

Enforcing casing, such as:

type MyObj = {
   name: IsKebabCase
}

When I go to create an object of type MyObj the name property will error if not in kebab case.

Utility types to enforce this would be golden

We can do this with built in Uppercase<T> and Lowercase<T> but it does not seem to work with DelimiterCase

Upvote & Fund

Fund with Polar

filipw01 commented 3 months ago

Have you tried Capitalize<CamelCase<T>> for PascalCase or KebabCase<T> for kebab case?