Fix type casting and type assertion with Ember modules APIs #343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The prior fix for TypeScript support avoids modifying any node who's parent node's type starts with
TS
. This fixed a large number of scenarios where an identifier happened to be both a type and a value.Unfortunately, there are some cases where the parent node is a
TS*
node but the node still needs to be transpiled to use the Ember global paths. For example:In this the parent node of that
addObserver
reference is aTSAsExpression
, but we do need to transpile it toEmber.addObserver
.And:
In this the parent node of that
addObserver
reference is aTSNonNullExpression
, but we do need to transpile it toEmber.addObserver
.After reviewing the
@babel/plugin-transform-typescript
implementation (see here) it seems that all of the otherTS*
style node types are directly removed (e.g.path.remove()
).Fixes #341