microsoft / microsoft/TypeScript
Project references: error when importing `tsx` file in referenced project
Aperta
@orta ci sta già lavorando.
Dal 10/6/2021.
Bug
Domain: tsc -b
Rescheduled
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.