type alias RefinedUnion

Extracts the union of all refined types from a record of refiners.

Examples

Example 1

import type { Refiner, RefinedUnion } from "@hertzg/binstruct";

type Refiners = {
  a: Refiner<number, string, []>;
  b: Refiner<number, boolean, []>;
};

type Result = RefinedUnion<Refiners>; // string | boolean

Type Parameters

T extends Record<string, Refiner<any, any, any>>

A record mapping keys to Refiner types

Definition

[K in keyof T]: T[K] extends Refiner<any, infer R, any> ? R : never[keyof T]

Usage

import { type RefinedUnion } from "mod.ts";