UNPKG

639 BTypeScriptView Raw
1import type {DelimiterCasedProperties} from './delimiter-cased-properties';
2
3/**
4Convert object properties to kebab case but not recursively.
5
6This can be useful when, for example, converting some API types from a different style.
7
8@see KebabCase
9@see KebabCasedPropertiesDeep
10
11@example
12```
13import type {KebabCasedProperties} from 'type-fest';
14
15interface User {
16 userId: number;
17 userName: string;
18}
19
20const result: KebabCasedProperties<User> = {
21 'user-id': 1,
22 'user-name': 'Tom',
23};
24```
25
26@category Change case
27@category Template literal
28@category Object
29*/
30export type KebabCasedProperties<Value> = DelimiterCasedProperties<Value, '-'>;