Skip to main content
100%

Power Query - get signature of a function as text. Use Signature(Table.Buffer) equals "function (table as table) as table". This is an M script

✓ Published0🌍 Public
HHugoberry
Last edited Apr 30, 2017
Created on Apr 25, 2017

This example demonstrates how to extract and display the signature of a Power Query function as readable text, using the M language. It defines a custom function that takes a function as input and returns its type signature, such as `function (table as table) as table`. The code serializes type information into text form using the `Type.Is` and `Type.IsNullable` functions, then iterates over parameter names and their types via `Type.FunctionParameters` and `Record.FieldNames`. It assembles the final signature with `Text.Combine`, handling optional parameters and nullable types, and appends the return type using `Type.FunctionReturn`. The result is a string representation of the function's contract.

AI-generated description

Similar vizzes