effect-io-ai

Package: effect
Module: Function

Function.FunctionN

Represents a function with multiple arguments.

When to use

Use to describe a function whose argument list is represented as a tuple type.

Example (Typing a variadic function)

import type { Function } from "effect"
import * as assert from "node:assert"

const sum: Function.FunctionN<[number, number], number> = (a, b) => a + b
assert.deepStrictEqual(sum(2, 3), 5)

Signature

type FunctionN<A, B> = (...args: A) => B

Source

Since v2.0.0