Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/actionify/src/deps/types.ts>StringKeyOf

Create and manage your GitHub workflows with TypeScript and Deno.
Latest
type alias StringKeyOf
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

import type {StringKeyOf} from 'type-fest';

type Foo = {
	1: number,
	stringKey: string,
};

type StringKeysOfFoo = StringKeyOf<Foo>;
//=> '1' | 'stringKey'
definition: `${Extract<keyof BaseType, string | number>}`