ApiContract<TApi>
The contract an API declares: every key is a method the API promises to expose, and its value optionally carries the payload schemas for that method.
Typed over the API when one is named: ApiContract<MyApi> has exactly one entry per function member of MyApi (a missing method, an extra one or a misspelled one does not compile), and each entry’s schemas must produce that method’s parameters and awaited return value. Without a type argument, or for object, it is the loose record a reader that knows nothing about the API sees.
Import:
import type { ApiContract } from '@mnaoumov/typescript-lib/api-contract';Signature:
export type ApiContract<TApi extends object = object>Signature:
type ApiContract<TApi> = object extends TApi ? Readonly<Record<string, ApiMethodContract>> : TypedApiContract<TApi>Type: object extends TApi ? Readonly<Record<string, ApiMethodContract>> : TypedApiContract<TApi>
Links to this page: