TypeScriptSyntax
Literal Type
Code example
type Dir = "left" | "right";Restricts a value to specific literals.
In TypeScript, literal type: restricts a value to specific literals — type Dir = "left" | "right";
type Dir = "left" | "right";type Dir = "left" | "right";Restricts a value to specific literals.
Use type Dir = "left" | "right";.
Use this pattern: type Dir = "left" | "right";
Yes. Use Copy code and adapt the example to your program.
No. The language syntax is the same across operating systems.