Prevents inference of a type parameter T.
T
🦴 utilities
💀 deprecated since 8.0.0: use NoInfer from TypeScript 5.4 instead
NoInfer
original version author
https://github.com/microsoft/TypeScript/issues/14829#issuecomment-298425341
function assertEqual<T>(a: T, b: NoInfer<T>) { return a === b}assertEqual(123, 324) // OKassertEqual(123, 'abc') // ErrorassertEqual({ x: 1 }, { x: 1, y: 2 }) // Error Copy
function assertEqual<T>(a: T, b: NoInfer<T>) { return a === b}assertEqual(123, 324) // OKassertEqual(123, 'abc') // ErrorassertEqual({ x: 1 }, { x: 1, y: 2 }) // Error
Prevents inference of a type parameter
T
.🦴 utilities