microsoft / microsoft/TypeScript

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

オープン
#58,142 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Domain: Error Messages Experience Enhancement Suggestion
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Issue にある TS.transpileModule の再現コードから始め、ファイル名 test.d.tsp.ts と示されている TypeScript のバージョンを使用します。失敗する出力生成パスを、成功する古いバージョンと比較し、.d. を含むファイル名の回帰テストを追加します。出力を伴うトランスパイルが成功し、クラッシュしなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。