type-plus
    Preparing search index...

    Type Alias NoInfer<T>

    NoInfer: Or<IsNull<T>, IsUndefined<T, Predicate>, { $else: T & {}; $then: T }>

    Prevents inference of a type parameter T.

    🦴 utilities

    Type Parameters

    • T

    💀 deprecated since 8.0.0: use NoInfer from TypeScript 5.4 instead

    original version author

    function assertEqual<T>(a: T, b: NoInfer<T>) {
    return a === b
    }

    assertEqual(123, 324) // OK
    assertEqual(123, 'abc') // Error
    assertEqual({ x: 1 }, { x: 1, y: 2 }) // Error