Opaque<T, U>: IsNarrowable<T, U> extends true
    ? T
    : never

Type Parameters

  • T

    Type to check

  • U

    Type to against

Returns type T if it is an opaque type of U

type Result = Opaque<string, 'foo'>
// ^? never
type Result = Opaque<string, string>
// ^? string