microsoft / microsoft/TypeScript

Project references: error when importing `tsx` file in referenced project

オープン
#44,540 コメント 6 件 リアクション 4 件 担当者 1 名 GitHub で見る

@orta がすでに取り組んでいます。

2021年6月10日 から。

Bug Domain: tsc -b Rescheduled
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

Bug Report

🔎 Search Terms

project references jsx tsx typescriptreact javascriptreact compiler options composite

🕗 Version & Regression Information
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about project references
⏯ Playground Link

N/A

💻 Code

Reduced test case: https://github.com/OliverJAsh/ts-project-references-jsx-bug

shared/tsconfig.json:

{
    "compilerOptions": {
        "composite": true,
        "jsx": "react",
    }
}

shared/foo-jsx.tsx:

export const foo = 1;

app/tsconfig.json:

{
  "compilerOptions": {
    "composite": true
  },
  "references": [
    {
      "path": "../shared/tsconfig.json"
    }
  ]
}

app/main.ts:

import * as fooJsx from "../shared/foo-jsx";

fooJsx;
  1. Run tsc --build app/tsconfig.json --verbose
🙁 Actual behavior
[18:36:23] Projects in this build:
    * shared/tsconfig.json
    * app/tsconfig.json

[18:36:23] Project 'shared/tsconfig.json' is out of date because output file 'shared/foo-jsx.js' does not exist

[18:36:23] Building project '/Users/oliverash/Development/ts-project-references-jsx-bug/shared/tsconfig.json'...

[18:36:24] Project 'app/tsconfig.json' is out of date because output file 'app/main.js' does not exist

[18:36:24] Building project '/Users/oliverash/Development/ts-project-references-jsx-bug/app/tsconfig.json'...

app/main.ts:1:25 - error TS6305: Output file '/Users/oliverash/Development/ts-project-references-jsx-bug/shared/foo-jsx.d.ts' has not been built from source file '/Users/oliverash/Development/ts-project-references-jsx-bug/shared/foo-jsx.tsx'.

1 import * as fooJsx from "../shared/foo-jsx";
                          ~~~~~~~~~~~~~~~~~~~


Found 1 error.
🙂 Expected behavior

No errors.


I am able to workaround the error by adding "jsx": "react" to app/tsconfig.json, but this feels redundant. The file I am importing is from a referenced project so I shouldn't need to set compiler options for this.

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

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

はじめの一歩

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

評価

この issue はまだ評価されていません。

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

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