bconnorwhite / typed-case

Convert between typesafe string casings
6 stars 0 forks source link

Incorrect output in some types #3

Open dkAndFed opened 1 month ago

dkAndFed commented 1 month ago

Hi, thanks for a great library! It's nice to have both conversion as well as types in the same library, really useful.

After using it I noticed that some types return a mix of supplied generics. It happens with CamelCase, PascalCase and some other similar ones. Other ones seem to work just fine, e.g. ConstantCase. Likely related to SplitWords type.

image
dkAndFed commented 1 month ago

Managed to solved it as follows. Not ideal but it works.

type Foo = 'foo-bar' | 'baz-qux';

type Bar =  keyof {
  [K in Foo as CamelCase<K>]: never;
};