Files
backend/.pnpm-store/v10/files/00/85c8fd263338bd5ae8cee969c13e9c9b6c036f8e624cf6ef0fe89103a272d12e22f55419148c2044bb2a4bdaf299808cca20d2454dd94be6fd0c22af607c5d
T
2026-03-22 13:31:39 +00:00

66 lines
1.4 KiB
Plaintext

import type {_DefaultDelimiterCaseOptions} from './delimiter-case.d.ts';
import type {DelimiterCasedPropertiesDeep} from './delimiter-cased-properties-deep.d.ts';
import type {ApplyDefaultOptions} from './internal/index.d.ts';
import type {WordsOptions} from './words.d.ts';
/**
Convert object properties to kebab case recursively.
This can be useful when, for example, converting some API types from a different style.
@see {@link KebabCase}
@see {@link KebabCasedProperties}
@example
```
import type {KebabCasedPropertiesDeep} from 'type-fest';
type User = {
userId: number;
userName: string;
};
type UserWithFriends = {
userInfo: User;
userFriends: User[];
};
const result: KebabCasedPropertiesDeep<UserWithFriends> = {
'user-info': {
'user-id': 1,
'user-name': 'Tom',
},
'user-friends': [
{
'user-id': 2,
'user-name': 'Jerry',
},
{
'user-id': 3,
'user-name': 'Spike',
},
],
};
const splitOnNumbers: KebabCasedPropertiesDeep<{line1: {line2: [{line3: string}]}}, {splitOnNumbers: true}> = {
'line-1': {
'line-2': [
{
'line-3': 'string',
},
],
},
};
```
@category Change case
@category Template literal
@category Object
*/
export type KebabCasedPropertiesDeep<
Value,
Options extends WordsOptions = {},
> = DelimiterCasedPropertiesDeep<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;
export {};