type-fest
Version:
A collection of essential TypeScript types
31 lines (23 loc) • 639 B
TypeScript
import type {DelimiterCasedProperties} from './delimiter-cased-properties';
/**
Convert object properties to kebab case but not recursively.
This can be useful when, for example, converting some API types from a different style.
```
import type {KebabCasedProperties} from 'type-fest';
interface User {
userId: number;
userName: string;
}
const result: KebabCasedProperties<User> = {
'user-id': 1,
'user-name': 'Tom',
};
```
*/
export type KebabCasedProperties<Value> = DelimiterCasedProperties<Value, '-'>;