Hyperlinkv0.8.0-beta.28

Function

Function.FunctionNtypeeffect/Function.ts:227
(...args: A): B

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)
models
export type FunctionN<A extends ReadonlyArray<unknown>, B> = (...args: A) => B