devtypes - v2.0.0
    Preparing search index...

    Type Alias AssertTypeWeak<T, D>

    AssertTypeWeak: T

    Weakly assert that a type is assignable to another type.

    Type Parameters

    • T extends D

      The inferred or concrete type to validate

    • D

      The expected destination (super) type

    Performs a non-strict compile-time check that T is assignable to D. Unlike strict assert types, this does not enforce exact equality and does not produce an error unless the assignment is invalid.

    This is useful for validating inferred or generic types without prematurely failing type evaluation.

    Note that this check is directional: T must extend D. Supersets of T are not rejected by design.

    type A = AssertTypeWeak< string, string | number >;  // ✓
    type B = AssertTypeWeak< 42, number >; // ✓

    type C = AssertTypeWeak< number, string >; // ✗ TS error

    // Superset behavior (intentional)
    type D = AssertTypeWeak< string, unknown >; // ✓