frontend/.pnpm-store/v3/files/55/c41ae0734058f7c45e8e2d7abbdbaee406e363d8cdf9a25fd354e6d9c2757fae1e0453c8864a598b28f98885e4b6840bbe962896166480d693488e3c404fcd

38 lines
724 B
Plaintext

import {DelimiterCase} from './delimiter-case';
/**
Convert a string literal to kebab-case.
This can be useful when, for example, converting a camel-cased object property to a kebab-cased CSS class name or a command-line flag.
@example
```
import {KebabCase} from 'type-fest';
// Simple
const someVariable: KebabCase<'fooBar'> = 'foo-bar';
// Advanced
type KebabCasedProperties<T> = {
[K in keyof T as KebabCase<K>]: T[K]
};
interface CliOptions {
dryRun: boolean;
includeFile: string;
foo: number;
}
const rawCliOptions: KebabCasedProperties<CliOptions> = {
'dry-run': true,
'include-file': 'bar.js',
foo: 123
};
```
@category Template Literals
*/
export type KebabCase<Value> = DelimiterCase<Value, '-'>;