@metreeca/blue - v0.12.0
    Preparing search index...

    Function resource

    Creates a resource shape.

    • Creates a resource shape.

      Extends the shapes given ahead of the members, carrying their members and constraints on top of the ones declared here; a member redeclared over an inherited one narrows it. The shape is built merged, so that a caller reads the members a resource carries off the shape itself rather than by walking the inheritance chain.

      Type Parameters

      • I extends Parents

        The shapes extended, possibly deferred to break definition cycles

      • M extends Members

        The members declared in the shape's own right

      Parameters

      • ...args: [...inheritance: I[], members: M]

        The shapes extended, followed by the members declared

      Returns ResourceShape<I, M>

      An immutable shape admitting the resources the members bound

      TraceError Where a member fails to narrow the one it overrides, the extended shapes disagree on an inherited constraint, or the merged shape states two identifiers, two types, or two members mapping to the same predicate

    • Creates a resource shape stating shape-level constraints.

      Extends the shapes given first, as the members-only form does, and holds every resource to the constraints stated between them and the members: what it is called, the class it belongs to, the space its members resolve their predicates against, and the identifiers it may be named by.

      Type Parameters

      • I extends Parents

        The shapes extended, possibly deferred to break definition cycles

      • M extends Members

        The members declared in the shape's own right

      Parameters

      • ...args: [
            ...inheritance: I[],
            constraints: ResourceConstraints & { kind?: undefined },
            members: M,
        ]

        The shapes extended, followed by the shape constraints and the members declared

      Returns ResourceShape<I, M>

      An immutable shape admitting the resources the members and constraints bound

      TraceError Where a member fails to narrow the one it overrides, the extended shapes disagree on an inherited constraint, or the merged shape states two identifiers, two types, or two members mapping to the same predicate