Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
babelTypes.FLIPPED_ALIAS_KEYS.Expression.push('TypeAssertedExpression');
Printer.prototype.ImportRequire = function (node) {
this.word('import');
this.print(node.local, node);
this.space();
this.token('=');
this.space();
this.word('require');
this.token('(');
this.print(node.source, node);
this.token(')');
this.semicolon();
};
Printer.prototype.TypeAssertedExpression = function (node) {
this.print(node.assertion, node);
this.space();
this.print(node.expression, node);
};
Printer.prototype.TypeAssertion = function (node) {
this.token('<');
this.word(node.value);
this.token('>');
};
Parser.prototype.tsParseImportRequire = function (node) {
this.next();
node.local = this.parseIdentifier();
this.eat(types.eq);
import Parser from "babylon/lib/parser";
import {types} from 'babylon/lib/tokenizer/types';
import Printer from 'babel-generator/lib/printer';
import * as babelTypes from 'babel-types';
babelTypes.TYPES.push('ImportRequire');
babelTypes.FLIPPED_ALIAS_KEYS.Expression.push('TypeAssertedExpression');
Printer.prototype.ImportRequire = function (node) {
this.word('import');
this.print(node.local, node);
this.space();
this.token('=');
this.space();
this.word('require');
this.token('(');
this.print(node.source, node);
this.token(')');
this.semicolon();
};
Printer.prototype.TypeAssertedExpression = function (node) {
this.print(node.assertion, node);
this.space();
this.print(node.expression, node);
this.token('=');
this.space();
this.word('require');
this.token('(');
this.print(node.source, node);
this.token(')');
this.semicolon();
};
Printer.prototype.TypeAssertedExpression = function (node) {
this.print(node.assertion, node);
this.space();
this.print(node.expression, node);
};
Printer.prototype.TypeAssertion = function (node) {
this.token('<');
this.word(node.value);
this.token('>');
};
Parser.prototype.tsParseImportRequire = function (node) {
this.next();
node.local = this.parseIdentifier();
this.eat(types.eq);
this.eatContextual('require');
this.eat(types.parenL);
node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected();
this.eat(types.parenR);
this.semicolon();