(...args: A): BRepresents 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
Source effect/Function.ts:2271 lines
export type type FunctionN<
A extends ReadonlyArray<unknown>,
B
> = (...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)
FunctionN<function (type parameter) A in type FunctionN<A extends ReadonlyArray<unknown>, B>A extends interface ReadonlyArray<T>ReadonlyArray<unknown>, function (type parameter) B in type FunctionN<A extends ReadonlyArray<unknown>, B>B> = (...args: A extends ReadonlyArray<unknown>args: function (type parameter) A in type FunctionN<A extends ReadonlyArray<unknown>, B>A) => function (type parameter) B in type FunctionN<A extends ReadonlyArray<unknown>, B>B