zerot
    Preparing search index...

    Type Alias ContractInvariant<TInput, TOutput>

    ContractInvariant: (
        input: TInput,
        output: TOutput,
    ) => boolean | Promise<boolean> | ContractError | Promise<ContractError>

    Defines a contract invariant condition function. Invariants check conditions that must hold true both before and after method execution.

    Type Parameters

    • TInput = any

      The expected type of the input to the method.

    • TOutput = any

      The expected type of the output of the method.

    Type declaration

      • (
            input: TInput,
            output: TOutput,
        ): boolean | Promise<boolean> | ContractError | Promise<ContractError>
      • Parameters

        • input: TInput

          The input to the method.

        • output: TOutput

          The output of the method.

        Returns boolean | Promise<boolean> | ContractError | Promise<ContractError>

        A boolean indicating if the invariant holds true, or a Promise resolving to a boolean, or a ContractError/Promise of ContractError if it fails.