@wpazderski/js-utils
    Preparing search index...

    Type Alias OpaqueStrict<TPrimary, TUnique>

    OpaqueStrict: TPrimary & { [P in TUnique]: never }

    Wrapper for primitive types to prevent accidental wrong assignments. This version is stricter than Opaque as it does not allow assignment of TPrimary directly (explicit "as ..." is required).

    Type Parameters

    • TPrimary

      The primary type that is being wrapped.

    • TUnique extends symbol

      A unique symbol to differentiate this opaque type from others.

    type MyString = OpaqueStrict<string, typeof _MyString>;
    declare const _MyString: unique symbol;