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

    Type Alias Opaque<TPrimary, TUnique>

    Opaque: TPrimary & { _type?: TUnique }

    Wrapper for primitive types to prevent accidental wrong assignments.

    Type Parameters

    • TPrimary

      The primary type that is being wrapped.

    • TUnique extends symbol

      A unique symbol to differentiate this opaque type from others.

    Type declaration

    • Optional_type?: TUnique

      Unique symbol to differentiate this opaque type from others.

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