Skip to content

defineApiContract<TApi>

States a contract against an API type, so every entry is checked against its method and the schema builders inside it infer their types from the method rather than from a restated tuple. It returns the contract as is.

Import:

import { defineApiContract } from '@mnaoumov/typescript-lib/api-contract';

Signature:

function defineApiContract(contract: TypedApiContract<NoInfer<TApi>>): TypedApiContract<TApi>

Parameters:

Parameter Type Description
contract TypedApiContract<NoInfer<TApi>> The contract.

Returns: TypedApiContract<TApi> — The same contract.