Type.FunctionReturn

Type

Returns the return type declared for a given function type.

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

Syntax

Type.FunctionReturn(type as type) as type

Parameters

NameTypeRequiredDescription
typetypeYesA function type whose return type is returned.

Return Value

typeThe declared return type of the function type.

Remarks

Type.FunctionReturn extracts the declared return type from a function type. When a function type explicitly declares its return type (e.g., type function (x as number) as text), this function returns that declared type. When no return type is declared, or when the return type is any, the result is type any.

This function operates on a function type value — not a function value directly. To get the type of an existing function, pass it through Value.Type(fn) first, then call Type.FunctionReturn on the result.

Type.FunctionReturn is used alongside Type.FunctionParameters for runtime signature inspection. Typical use cases include:

- Documentation generators that describe what a function produces - Generic pipelines that need to validate or adapt based on a function's output type - Custom connector development where function return types are declared programmatically

Most built-in Power Query functions declare nullable return types (e.g., type nullable number) because they can return null when inputs are null.

Examples

Example 1: Return type of a typed function literal

let
    FType = type function (x as number) as text
in
    Type.FunctionReturn(FType)
Result
Result
1type text

Example 2: Return type of a built-in function

Result
Result
1type nullable number

Example 3: Undeclared return type produces type any

let
    FType = type function (x as number) as any
in
    Type.FunctionReturn(FType)
Result
Result
1type any

Compatibility

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