This was released in version 1.8 as “string literal types”
What’s New in Typescript – String Literal Types
Example from the page:
interface AnimationOptions {
deltaX: number;
deltaY: number;
easing: "ease-in" | "ease-out" | "ease-in-out";
}
More Related Contents:
- Transform union type to intersection type
- Type union not checking for excess properties
- ‘any’ vs ‘Object’
- Get an object’s class name at runtime
- How to convert a string to number in TypeScript?
- How to use jQuery with TypeScript
- Type definition in object literal in TypeScript
- Confusing “duplicate identifier” Typescript error message
- How do I declare object value type without declaring key type?
- TypeScript: void return type converted to any type?
- Angular 2 beta.17: Property ‘map’ does not exist on type ‘Observable’
- why is return type `null` (or any other type) assignable to return type `void`?
- Call a global variable inside module
- Obtaining the return type of a function
- What does “… resolves to a non-module entity and cannot be imported using this construct” mean?
- for-in statement
- How to cast object to another type and remove unneeded fields in TypeScript?
- TypeScript filter out nulls from an array
- Typescript: Omit a property from all interfaces in a union, but keep the union structure
- Declaring abstract method in TypeScript
- “An index signature parameter type cannot be a union type.” – what should I use instead?
- Typescript and spread operator?
- Detailed differences between type annotation `variable: type` and type assertion `expression as type` in TypeScript
- Generic and typeof T in the parameters
- Angular 2 loader on each http request
- Typescript: type narrowing not working for `in` when key is stored in a variable
- Run factory function on import in TypeScript?
- How do I decide whether @types/* goes into `dependencies` or `devDependencies`?
- How to define an interface for objects with dynamic keys?
- Types from both keys and values of object in Typescript