TypeScriptSyntax
Define a Type Alias
Code example
type ID = string | number;Names a type so it can be reused.
In TypeScript, define a type alias: names a type so it can be reused — type ID = string | number;
type ID = string | number;type ID = string | number;Names a type so it can be reused.
Use type ID = string | number;.
Use this pattern: type ID = string | number;
Yes. Use Copy code and adapt the example to your program.
No. The language syntax is the same across operating systems.