DeprecatedThis package is deprecated
SWC Types • A babel/types-like set of helpers for swc.
The development of this plugin has been suspended for maintenance reasons after an initial trial period. Developments will follow when the swc project will be more stable.
Install
$ npm i @chialab/swc-types -D
$ yarn add @chialab/swc-types -D
Usage
import { t, Visitor } from '@chialab/swc-types';
export class ConsoleVisitor extends Visitor {
visitCallExpression(e: CallExpression): Expression {
if (!t.isMemberExpression(e.callee)) {
return e;
}
if (t.isIdentifier(e.callee.object) && e.callee.object.value === 'console') {
if (t.isIdentifier(e.callee.property)) {
return t.unaryExpression('void', t.numericLiteral(0));
}
}
return e;
}
}
License
SWC Types is released under the MIT license.