microsoft / microsoft/TypeScript
Project references: error when importing `tsx` file in referenced project
Ouverte
@orta y travaille déjà.
Depuis le 10/6/2021.
Bug
Domain: tsc -b
Rescheduled
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.4k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 117
Description
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;
- 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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Évaluation
Cette issue n'a pas encore été évaluée.