microsoft / microsoft/TypeScript

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

Open
#58,142 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: Error Messages Experience Enhancement Suggestion
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

🔎 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
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TS.transpileModule reproduction in the issue, using the filename test.d.tsp.ts and the TypeScript versions shown. Compare the failing output-generation path with the successful older version and add a regression test for filenames containing .d.; done means transpilation succeeds with output and no crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.