type alias OneOf

This is a utility type that allows you to get the keys from a list.

Examples

Example 1

const MyList = ['apple', 'banana', 'orange'] as const;

function example2(param: OneOf<typeof MyList>): void {
  // param would be: "apple" | "banana" | "orange"
}

Type Parameters

T extends Readonly<unknown[]>

Definition

T[number]

Usage

import { type OneOf } from ".";