Open BenoitZugmeyer opened 1 year ago
This plugin can output code with a syntax error. Taking the following TypeScript code as input:
toto = (function () { // tata } as any)
The following output is emitted by the plugin:
[...] toto = (function () { cov_131zeqpl6j().f[0]++; } // tata as any);
As you can see, the comment has been moved outside the function, and now the as operator is on a new line. It seems that this syntax is not supported by typescript.
as
Minimal Node.js script to reproduce:
const { transformSync } = require("@babel/core"); const result = transformSync( ` toto = (function () { // tata } as any) `, { filename: "toto.ts", plugins: [["@babel/plugin-syntax-typescript"], ["istanbul"]], } ); console.log(result.code);
This plugin can output code with a syntax error. Taking the following TypeScript code as input:
The following output is emitted by the plugin:
As you can see, the comment has been moved outside the function, and now the
as
operator is on a new line. It seems that this syntax is not supported by typescript.Minimal Node.js script to reproduce: