How to use the @tslab/typescript-for-tslab.isExportDeclaration function in @tslab/typescript-for-tslab

To help you get started, we’ve selected a few @tslab/typescript-for-tslab examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yunabe / tslab / src / converter.ts View on Github external
return (node: ts.SourceFile) => {
        for (let i = node.statements.length - 1; i >= 0; i--) {
          const stmt = node.statements[i];
          if (ts.isExportDeclaration(stmt)) {
            continue;
          }
          if (!ts.isExpressionStatement(stmt)) {
            break;
          }
          const lastName = createLastExprVar();
          let statements = node.statements.slice(0, i);
          statements.push(
            ts.createVariableStatement(
              [ts.createModifier(ts.SyntaxKind.ExportKeyword)],
              ts.createVariableDeclarationList(
                [
                  ts.createVariableDeclaration(
                    lastName,
                    undefined,
                    stmt.expression
github yunabe / tslab / src / converter.ts View on Github external
return (node: ts.SourceFile) => {
        const statements = [];
        for (const stmt of node.statements) {
          if (ts.isExportDeclaration(stmt)) {
            continue;
          }
          statements.push(stmt);
        }
        node.statements = ts.createNodeArray(statements);
        return node;
      };
    }