Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.8.0-beta: ts.transpile now errors for .js files #6766

Closed
frankwallis opened this issue Jan 31, 2016 · 5 comments
Closed

1.8.0-beta: ts.transpile now errors for .js files #6766

frankwallis opened this issue Jan 31, 2016 · 5 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@frankwallis
Copy link
Contributor

The ts.transpile method now throws an error when given a file with a .js extension:

test.js:

var ts = require("typescript");
var diags = [];
var output = ts.transpile("const a = 10; export default a;", { module: 1 }, "input.js", diags);
console.log(output);
console.log(JSON.stringify(diags));

output:

Heracles:plugin-typescript frank$ node test.js
/Users/frank/work/plugin-typescript/node_modules/typescript/lib/typescript.js:1682
                throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString);
                ^

Error: Debug Failure. False expression: Output generation failed
    at Object.assert (/Users/frank/work/plugin-typescript/node_modules/typescript/lib/typescript.js:1682:23)
    at transpileModule (/Users/frank/work/plugin-typescript/node_modules/typescript/lib/typescript.js:47824:18)
    at Object.transpile (/Users/frank/work/plugin-typescript/node_modules/typescript/lib/typescript.js:47832:22)
    at Object.<anonymous> (/Users/frank/work/plugin-typescript/test.js:3:4)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:138:18)

The actual error causing this is TS5055:

Cannot write file 'input.js' because it would overwrite input file.

This breaks e.g. the systemjs built-in typescript transpilation:(https://github.com/systemjs/systemjs/blob/6243d0c7700ca802699796cfae0f9e213072e077/dist/system.src.js#L1210)
Looks to be caused by the changes made for allowJs option in #5471.

@denis-sokolov
Copy link

May we see a 1.8 branch with this fix? Currently the entire 1.8 branch is broken for us, a 1.8.3 release would be appreciated.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 26, 2016

@denis-sokolov this has been ported in release-1.8 a while back in #6791.

do you see the same issue on typescript@1.8.2?

@denis-sokolov
Copy link

@mhegazy, ah, sorry, I did not find that it was ported. Yes, I did all my testing on 1.8.2, I never had 1.8.0 installed. I shall double-check, just in case. Anything else to be on the lookout for?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 27, 2016

We believe this issue has been fixed. if you are still running into issues please file a new issue and give us more information to be able to diagnose it.

@denis-sokolov
Copy link

For other people who stumble here. My problem was caused by the es6-default-import-commonjs problem, and was solved by upgrading ts-loader from 0.7.2 to 0.8.1.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants