|
|
@ -17,6 +17,16 @@ function remove_this_param(node, context) {
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {Visitors<any, null>} */
|
|
|
|
/** @type {Visitors<any, null>} */
|
|
|
|
const visitors = {
|
|
|
|
const visitors = {
|
|
|
|
|
|
|
|
_(node, context) {
|
|
|
|
|
|
|
|
context.next();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO there may come a time when we decide to preserve type annotations.
|
|
|
|
|
|
|
|
// until that day comes, we just delete them so they don't confuse esrap
|
|
|
|
|
|
|
|
delete node.typeAnnotation;
|
|
|
|
|
|
|
|
delete node.typeParameters;
|
|
|
|
|
|
|
|
delete node.returnType;
|
|
|
|
|
|
|
|
delete node.accessibility;
|
|
|
|
|
|
|
|
},
|
|
|
|
Decorator(node) {
|
|
|
|
Decorator(node) {
|
|
|
|
e.typescript_invalid_feature(node, 'decorators (related TSC proposal is not stage 4 yet)');
|
|
|
|
e.typescript_invalid_feature(node, 'decorators (related TSC proposal is not stage 4 yet)');
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -78,23 +88,12 @@ const visitors = {
|
|
|
|
TSNonNullExpression(node, context) {
|
|
|
|
TSNonNullExpression(node, context) {
|
|
|
|
return context.visit(node.expression);
|
|
|
|
return context.visit(node.expression);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
TSTypeAnnotation() {
|
|
|
|
|
|
|
|
// This isn't correct, strictly speaking, and could result in invalid ASTs (like an empty statement within function parameters),
|
|
|
|
|
|
|
|
// but esrap, our printing tool, just ignores these AST nodes at invalid positions, so it's fine
|
|
|
|
|
|
|
|
return b.empty;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
TSInterfaceDeclaration() {
|
|
|
|
TSInterfaceDeclaration() {
|
|
|
|
return b.empty;
|
|
|
|
return b.empty;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
TSTypeAliasDeclaration() {
|
|
|
|
TSTypeAliasDeclaration() {
|
|
|
|
return b.empty;
|
|
|
|
return b.empty;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
TSTypeParameterDeclaration() {
|
|
|
|
|
|
|
|
return b.empty;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
TSTypeParameterInstantiation() {
|
|
|
|
|
|
|
|
return b.empty;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
TSEnumDeclaration(node) {
|
|
|
|
TSEnumDeclaration(node) {
|
|
|
|
e.typescript_invalid_feature(node, 'enums');
|
|
|
|
e.typescript_invalid_feature(node, 'enums');
|
|
|
|
},
|
|
|
|
},
|
|
|
|