-
-
Notifications
You must be signed in to change notification settings - Fork 590
/
Copy pathkebab-cased-properties.d.ts
40 lines (32 loc) · 1 KB
/
kebab-cased-properties.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type {DefaultDelimiterCaseOptions} from './delimiter-case';
import type {DelimiterCasedProperties} from './delimiter-cased-properties';
import type {ApplyDefaultOptions} from './internal';
import type {WordsOptions} from './words';
/**
Convert object properties to kebab case but not recursively.
This can be useful when, for example, converting some API types from a different style.
@see KebabCase
@see KebabCasedPropertiesDeep
@example
```
import type {KebabCasedProperties} from 'type-fest';
interface User {
userId: number;
userName: string;
}
const result: KebabCasedProperties<User> = {
'user-id': 1,
'user-name': 'Tom',
};
const splitOnNumbers: KebabCasedProperties<{line1: string}, {splitOnNumbers: true}> = {
'line-1': 'string',
};
```
@category Change case
@category Template literal
@category Object
*/
export type KebabCasedProperties<
Value,
Options extends WordsOptions = {},
> = DelimiterCasedProperties<Value, '-', ApplyDefaultOptions<WordsOptions, DefaultDelimiterCaseOptions, Options>>;