⚠️ Internal: This API is not publically exported by the package.

      Interface Constructor<A>

      Since

      2.0.0

      interface Constructor {
          [RefinedConstructorsTypeId]: typeof RefinedConstructorsTypeId;
          either(args): Either<BrandErrors, A>;
          is(a): a is Unbranded<A> & A;
          option(args): Option<A>;
          (args): A;
      }

      Type Parameters

      • in out A extends Brand<any>

      Hierarchy

      • Constructs a branded type from a value of type A, throwing an error if the provided A is not valid.

        Parameters

        Returns A

      Methods

      • Constructs a branded type from a value of type A, returning Right<A> if the provided A is valid, Left<BrandError> otherwise.

        Parameters

        Returns Either<BrandErrors, A>

      • Attempts to refine the provided value of type A, returning true if the provided A is valid, false otherwise.

        Parameters

        Returns a is Unbranded<A> & A

      • Constructs a branded type from a value of type A, returning Some<A> if the provided A is valid, None otherwise.

        Parameters

        Returns Option<A>

      Properties

      [RefinedConstructorsTypeId]: typeof RefinedConstructorsTypeId