Type Alias NoInfer<T>

NoInfer<T>: Or<IsNull<T>, IsUndefined<T, $SelectionPredicate>, T, T & {}>

Prevents inference of a type parameter T.

🦴 utilities

Type Parameters

  • T

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

A build-in NoInfer is coming soon.