type-alias / @typed/router/Matcher

GuardType.Output

Extracts the matched output type from a Guard or Guard adapter.

Package version
1.0.0-beta.7
Category
Type utilities
Since
1.0.0
Member of
GuardType

Import

import { GuardType } from "@typed/router/Matcher";

Access GuardType.Output through the imported GuardType export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

type Output<T> = [
    T
] extends [
    Guard<infer _I, infer O, infer _E, infer _R>
] ? O : [
    T
] extends [
    AsGuard<infer _I, infer O, infer _E, infer _R>
] ? O : never;

Why

The extractor lets record and dispatch combinators derive their output without duplicating conditional types.

Ownership and lifetime

This compile-time type acquires no resources and has no runtime lifetime.

Examples

import type { Guard } from "@typed/guard"
type Output = Guard.Output<Guard<string, number>>

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source