frontend/.pnpm-store/v3/files/c9/254946d03cb684005c9a9573b602bc35521878916cd94d94354ad83b3564a85a86f4a4da0735b3ccced0c06b8683a6862d33698f1a74cef672fb47db9851c4

26 lines
506 B
Plaintext

/**
Get keys of the given type as strings.
Number keys are converted to strings.
Use-cases:
- Get string keys from a type which may have number keys.
- Makes it possible to index using strings retrieved from template types.
@example
```
import type {StringKeyOf} from 'type-fest';
type Foo = {
1: number,
stringKey: string,
};
type StringKeysOfFoo = StringKeyOf<Foo>;
//=> '1' | 'stringKey'
```
@category Object
*/
export type StringKeyOf<BaseType> = `${Extract<keyof BaseType, string | number>}`;