[TS] Transform multiple assert and assign correctly (#7217)

* Transform multiple assert and assign correctly

* Handling nested TSAsExpressions in the transform
This commit is contained in:
Maaz Syed Adeeb 2018-09-08 04:53:18 +05:30 committed by Logan Smyth
parent 7273cf8fe5
commit 7accee9c24
3 changed files with 7 additions and 1 deletions

View File

@ -250,7 +250,11 @@ export default declare((api, { jsxPragma = "React" }) => {
},
TSAsExpression(path) {
path.replaceWith(path.node.expression);
let { node } = path;
do {
node = node.expression;
} while (t.isTSAsExpression(node));
path.replaceWith(node);
},
TSNonNullExpression(path) {

View File

@ -0,0 +1 @@
(a as number as any) = 42;