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

"Output generation failed" when transpiling "test.d.abc.ts" #58142

Open
oldrich-s opened this issue Apr 10, 2024 · 4 comments
Open

"Output generation failed" when transpiling "test.d.abc.ts" #58142

oldrich-s opened this issue Apr 10, 2024 · 4 comments
Labels
Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Milestone

Comments

@oldrich-s
Copy link

🔎 Search Terms

"Output generation failed", "transpileModule"

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions 5.0.0-dev.20230109 and 5.0.0-dev.20230110
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about file names

⏯ Playground Link

No response

💻 Code

const TS = require('typescript')

const res = TS.transpileModule('export const x = 6;', {
    fileName: 'test.d.tsp.ts',
});

console.log(res)

🙁 Actual behavior

The Typescript compiler crashes. The compiler should allow files that contain .d. in their name.

🙂 Expected behavior

The compilation succeeds

Additional information about the issue

c:\Users\osv\Downloads\test>npm i typescript@5.0.0-dev.20230110

changed 1 package, and audited 2 packages in 5s

found 0 vulnerabilities

c:\Users\osv\Downloads\test>node main.js
c:\Users\osv\Downloads\test\node_modules\typescript\lib\typescript.js:1772
          throw e;
          ^

Error: Debug Failure. Output generation failed
    at Object.transpileModule (c:\Users\osv\Downloads\test\node_modules\typescript\lib\typescript.js:127318:20)
    at Object.<anonymous> (c:\Users\osv\Downloads\test\main.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.11.1

c:\Users\osv\Downloads\test>npm i typescript@5.0.0-dev.20230109

changed 1 package, and audited 2 packages in 745ms

found 0 vulnerabilities

c:\Users\osv\Downloads\test>node main.js
{
  outputText: '"use strict";\r\n' +
    'Object.defineProperty(exports, "__esModule", { value: true });\r\n' +
    'exports.x = void 0;\r\n' +
    'exports.x = 6;\r\n',
  diagnostics: [],
  sourceMapText: undefined
}
@MartinJohns
Copy link
Contributor

I can't find where it was written right now, but filenames matching *.d.*ts are considered declaration files. That's probably causing issues here.

@oldrich-s
Copy link
Author

@IllusionMH
Copy link
Contributor

Related #53319 and specifically #53319 (comment)

@andrewbranch andrewbranch added the Working as Intended The behavior described is the intended behavior; this is not a bug label Apr 10, 2024
@weswigham
Copy link
Member

@andrewbranch Maybe we should take this as a request to make the output a bit more informative than Debug Failure. Output generation failed? Surely we could issue a more specific and helpful diagnostic (or, like, actually issue a diagnostic at all instead of a Debug Failure)?

@andrewbranch andrewbranch added Suggestion An idea for TypeScript Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements and removed Working as Intended The behavior described is the intended behavior; this is not a bug labels Apr 10, 2024
@andrewbranch andrewbranch added this to the Backlog milestone Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants