Type.FunctionParameters
TypeReturns a record of parameter types for a given function type.
Syntax
Type.FunctionParameters(type as type) as recordParameters
| Name | Type | Required | Description |
|---|---|---|---|
type | type | Yes | A function type whose parameter types are returned. |
Return Value
record — A record where each field name is a parameter name and each value is the parameter's type.
Remarks
Type.FunctionParameters returns a record describing the parameter types of a function type. Each field in the result corresponds to one parameter: the field name is the parameter name, and the value is the parameter's declared type. The order of fields in the result matches the parameter order in the function signature.
This function operates on a function type — not a function value directly. To get the type of an existing function value, use Value.Type(myFunction) first, then pass the result to Type.FunctionParameters.
Type.FunctionParameters is used in metaprogramming scenarios such as runtime signature inspection, documentation generation, or building generic pipelines that adapt their behavior based on the parameters a function accepts. For related introspection, use Type.FunctionReturn to get the return type and Type.FunctionRequiredParameters to determine how many parameters are required.
Note that optional parameters appear in the result with their declared type just like required parameters — to distinguish required from optional, check the count returned by Type.FunctionRequiredParameters.
Examples
Example 1: Get parameter types of a simple function type
let
FType = type function (x as number, y as text) as logical
in
Record.ToTable(Type.FunctionParameters(FType))Name | Value | |
|---|---|---|
| 1 | x | type number |
| 2 | y | type text |
Example 2: Inspect parameter types of a built-in function
let
FType = Value.Type(Number.Round)
in
Record.ToTable(Type.FunctionParameters(FType))Name | Value | |
|---|---|---|
| 1 | number | type nullable number |
| 2 | digits | type nullable number |
| 3 | roundingMode | type nullable number |
Example 3: Count the total parameters of a function
let
FType = Value.Type(Text.BetweenDelimiters)
in
Record.FieldCount(Type.FunctionParameters(FType))Result | |
|---|---|
| 1 | 5 |