Type alias GetDataEnumKind<T, K>

GetDataEnumKind<T, K>: Extract<T, {
    __kind: K;
}>

Extracts a variant from a data enum.

Example

type WebPageEvent =
| { __kind: 'pageview', url: string }
| { __kind: 'click', x: number, y: number };
type ClickEvent = GetDataEnumKind<WebPageEvent, 'click'>;
// -> { __kind: 'click', x: number, y: number }

Type Parameters

  • T extends DataEnum

  • K extends T["__kind"]

Generated using TypeDoc