Type.FunctionRequiredParameters

Type

Returns the minimum number of required parameters for a function type.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Type.FunctionRequiredParameters(type as type) as number

Parameters

NameTypeRequiredDescription
typetypeYesA function type whose required parameter count is returned.

Return Value

numberThe count of required (non-optional) parameters in the function type.

Remarks

Type.FunctionRequiredParameters returns the number of parameters that must always be provided when calling a function. Optional parameters (declared with the optional keyword) are not counted.

Use Value.Type(fn) to get the function type before passing it to this function.

This is useful for building validation logic, documentation, or dynamic dispatch based on the arity of a function.

Examples

Example 1: Required parameters of a two-argument function

let
    FType = type function (x as number, y as number) as number
in
    Type.FunctionRequiredParameters(FType)
Result
Result
12

Example 2: Optional parameters are not counted

let
    FType = type function (x as number, optional y as nullable number) as number
in
    Type.FunctionRequiredParameters(FType)
Result
Result
11

Example 3: Check required parameters of Number.Round

Result
Result
11

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks