frontend/.pnpm-store/v3/files/55/6d4552b47e7d1b663894dfc7c3e568490d585912a5a91b9e207d3c36413e4065536837e68c3fe5e23872d24adbb42808c8e0a5b03d5cf23c50af1b235facd2

35 lines
699 B
Plaintext

import type {PascalCase} from './pascal-case';
/**
Convert object properties to pascal case but not recursively.
This can be useful when, for example, converting some API types from a different style.
@see PascalCase
@see PascalCasedPropertiesDeep
@example
```
import type {PascalCasedProperties} from 'type-fest';
interface User {
userId: number;
userName: string;
}
const result: PascalCasedProperties<User> = {
UserId: 1,
UserName: 'Tom',
};
```
@category Change case
@category Template literal
@category Object
*/
export type PascalCasedProperties<Value> = Value extends Function
? Value
: Value extends Array<infer U>
? Value
: {[K in keyof Value as PascalCase<K>]: Value[K]};