In Power Query (M) I've found 2 ways to declare types: myVar as type
or type text
Each seems to apply to different contexts. For example:
Table.AddColumn(myTable, "NewName", each [aColumn], type text)
or
MyFunc = (aParam as any) as date => Date.From(aParam)
However, this doesn't work as I expect for more complex types, like {text}
or {number}
, which would be a list of only text values or only numbers. I can use these types with the type
syntax, but not the as type
syntax.
Why/not?
Also, does declaring types in M have any performance impact, or is it just to raise an error if an incorrect type is passed/returned?