snippettypescriptCritical
How to create enum like type in TypeScript?
Viewed 0 times
enumtypescripthowliketypecreate
Problem
I'm working on a definitions file for the Google maps API for TypeScript.
And I need to define an enum like type eg.
How should this be done in TypeScript?
And I need to define an enum like type eg.
google.maps.Animation which contains two properties: BOUNCE and DROP.How should this be done in TypeScript?
Solution
TypeScript 0.9+ has a specification for enums:
The final comma is optional.
enum AnimationType {
BOUNCE,
DROP,
}The final comma is optional.
Code Snippets
enum AnimationType {
BOUNCE,
DROP,
}Context
Stack Overflow Q#12687793, score: 176
Revisions (0)
No revisions yet.