NonReducibleUnknown type​
Signature:
export type NonReducibleUnknown = {} | null | undefined;
Remarks​
T | unknown
reduces to unknown
and that can be problematic when it comes to contextual typing. It especially is a problem when the union has a function member, like here:
declare function test(cbOrVal: ((arg: number) => unknown) | unknown): void;
test((arg) => {}) // oops, implicit any
This type can be used to avoid this problem. This union represents the same value space as unknown
.