sucrase
Version:
Super-fast alternative to Babel for when you can target modern JS runtimes
17 lines (16 loc) • 551 B
JavaScript
import Transformer from "./Transformer";
export default class FlowTransformer extends Transformer {
constructor(rootTransformer, tokens) {
super();
this.rootTransformer = rootTransformer;
this.tokens = tokens;
}
process() {
// We need to handle all classes specially in order to remove `implements`.
if (this.tokens.matchesKeyword("class")) {
this.rootTransformer.processClass();
return true;
}
return this.rootTransformer.processPossibleTypeRange();
}
}