@oazmi/kitchensink - v0.9.13
    Preparing search index...

    Type Alias UnionKnown<A, B>

    UnionKnown: (unknown extends A ? B : A) | (unknown extends B ? A : B)

    perform a union between two types, making sure that if either is unknown, then it'll be treated as never.

    why is this useful? because in typescript's unknown is a supertype of all types (similar to any), which means that something like T | unknown = unknown. thus, in a scenario where such a behavior is not desired, you can use this utility type: UnionKnown<T, unknown> = T

    Type Parameters

    • A
    • B