Metakit / @doeixd/metakit/operation
define
function · packages/metakit/src/operationDefine.ts:150
function define<
const Id extends string,
const Args extends ReadonlyArray<Schema.Top>,
R extends Schema.Top,
const V extends number = 1,
const N extends 'strict' | 'own' = 'strict',
const C extends Claims<Args, R> = {},
>(spec: {
readonly id: Id & NotCore<Id>
readonly version?: V
readonly args: Args
readonly returns: R
readonly nulls?: N
readonly claims?: C
}): Operation<Id, V, Args, R, N, C>Declare a typed custom operation with Schemas and algebraic claims.
Returns a callable function that builds Call expressions, with .descriptor
holding the ForeignOp carried in expression trees. version is 1 when omitted;
a changed meaning takes a new one.