How to create enum like type in TypeScript? Ask Question

How to create enum like type in TypeScript? Ask Question

I'm working on a definitions file for the Google maps API for 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?

ベストアンサー1

TypeScript 0.9+ has a specification for enums:

enum AnimationType {
    BOUNCE,
    DROP,
}

The final comma is optional.

おすすめ記事