Convert a string literal to camel-case.
This can be useful when, for example, converting some kebab-cased command-line flags or a snake-cased database result.
Signature:
export declare type CamelCase<K> = K extends string ? CamelCaseStringArray<Split<K extends Uppercase<K> ? Lowercase<K> : K, WordSeparators>> : K;
``` import {CamelCase} from ‘type-fest’;
// Simple
const someVariable: CamelCase<‘foo-bar’> = ‘fooBar’;
// Advanced
type CamelCasedProperties
interface RawOptions { ‘dry-run’: boolean; ‘full_family_name’: string; foo: number; BAR: string; QUZ_QUX: number; ‘OTHER-FIELD’: boolean; }
const dbResult: CamelCasedProperties
Template Literals