import { Statement , Node } from './types' ; export function transform ( statements ) { return typescript ( statements ) ; } /** Convert TS to JS: remove type annotations and declarations */ function typescript ( statements ) { return statements . flatMap ( transformStatement ) ; function transformStatement ( statement ) { switch ( statement . kind ) { case Node . ExpressionStatement : return [ statement ] ; case Node . Var : return [ { ... statement , typename : undefined } ] ; case Node . TypeAlias : return [ ] ; } } }