I know about union types, but what does this pipe syntax mean?
let propName: "name" | "age" | "location";
Source: https://blogs.msdn.microsoft.com/typescript/2016/12/07/announcing-typescript-2-1/
I know about union types, but what does this pipe syntax mean?
let propName: "name" | "age" | "location";
Source: https://blogs.msdn.microsoft.com/typescript/2016/12/07/announcing-typescript-2-1/
We call it pipeline operator.
The experimental pipeline operator |>
(currently at stage 1) allows the creation of chained function calls in a readable manner. Basically, the pipeline operator provides syntactic sugar on a function call with a single argument allowing you to write
'%21' |> decodeURI
instead of decodeURI('%21')
.
Eg: This is how it works
To answer my own question: those are "String Literal Types" as in https://www.typescriptlang.org/docs/handbook/advanced-types.html#string-literal-types