Milestone: Decorator Support #63
Description
This issue it to track progress against supporting decorators within the final AST that the parser produces. We currently remove them during parsing.
We need to ensure that the following are accurately carried over from the original TypeScript AST:
- Parameter Decorators
- On instance member
- On static member
- In constructor
- Method Decorators
- On instance member
- On static member
- Accessor Decorators
- On instance member
- On static member
- Property Decorators
- On instance member
- On static member
- Class Decorators
We also need to account for the difference between decorators and decorator factories:
At the AST-level, the decorator node has an Identifier
TSNode as an expression
, whereas the decorator factory has a CallExpression
TSNode.
Decorators are not currently covered by the ESTree spec as they are still a fairly early-stage es-proposal, but Angular 2, for example, has adopted them as a core aspect of the framework.
TypeScript adds a decorators
array to the node in question, and I propose we do the same.
Resources:
https://www.typescriptlang.org/docs/handbook/decorators.html