import { type StringKeyOf } from "https://deno.land/x/actionify@0.3.0/src/deps/types.ts";
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.
Examples
Example 1
Example 1
import type {StringKeyOf} from 'type-fest';
type Foo = {
1: number,
stringKey: string,
};
type StringKeysOfFoo = StringKeyOf<Foo>;
//=> '1' | 'stringKey'