CamelCase<S>
MediumP3Coding
Implement CamelCase<S>: convert a kebab-case string literal type to camelCase.
Words are separated by single hyphens. The result is lower case except for the first letter of each word after the first, which is upper case. A string with no hyphens is just lower-cased; other separators such as _ are not special.
Tests your type must pass
type cases = [ Expect<Equal<CamelCase<'foobar'>, 'foobar'>>, Expect<Equal<CamelCase<'FOOBAR'>, 'foobar'>>, Expect<Equal<CamelCase<'foo-bar'>, 'fooBar'>>, Expect<Equal<CamelCase<'foo-bar-baz'>, 'fooBarBaz'>>, Expect<Equal<CamelCase<'FOO-BAR'>, 'fooBar'>>, Expect<Equal<CamelCase<'a-b-c'>, 'aBC'>>, Expect<Equal<CamelCase<'foo_bar'>, 'foo_bar'>>, Expect<Equal<CamelCase<''>, ''>>, ]
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
TypeScript
Run and Submit type-check your solution against the tests. ⌘Enter runs, ⌘⇧Enter submits.