microsoft / microsoft/TypeScript
TypeScript skips type-checking despite deleted file in referenced project
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
Acknowledgement
- I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment
We have encountered an unusual case in our project references setup. Below is a description of the current configuration. I believe there might be a gap in our setup or configuration that is causing this issue.
Setup
- We have two projects: 'bar' and 'foo'
- 'foo' references 'bar'
- 'foo/src/index2.ts' consumes a function from "bar/clean" (The entry point is created using TypeScript paths at the repo root tsconfig)
- 'tsconfig.project-references.json' at the repo root is our solution file, containing links to the projects
- Base tsconfig
{
"compilerOptions": {
"baseUrl": "./",
"outDir": "out-tsc/frontend/base",
"incremental": true,
"composite": true,
"target": "ES2020",
"lib": ["ES2022", "DOM"],
"jsx": "react",
"jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment",
"types": [],
"module": "ESNext",
"moduleResolution": "Node10",
"resolveJsonModule": true,
"importHelpers": true,
"isolatedModules": false,
"allowSyntheticDefaultImports": true,
"allowImportingTsExtensions": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"experimentalDecorators": false,
"verbatimModuleSyntax": true,
"emitDeclarationOnly": true,
"paths": {
"bar/clean": ["packages/bar/src/clean.ts"]
}
}
}
Steps to reproduce the issue
-
Run TypeScript build with project references. This should create a 'tsDist' folder at the repo root with emitted declarations:
yarn tsc -b tsconfig.project-references.json -v -
Delete the file 'packages/bar/src/clean.ts'. This file is consumed by 'packages/foo/src/index2.ts'. Note that we have paths defined for 'bar/clean' in 'tsconfig.json':
rm packages/bar/src/clean.ts -
Run TypeScript build with project references again. This should update the 'tsDist' folder at the repo root with emitted declarations. However, it doesn't throw any error, even though 'packages/foo/src/index2.ts' is consuming a non-existent file:
yarn tsc -b tsconfig.project-references.json -v
Repository for reproduction - https://github.com/sudesh-atlassian/project-references-debug-1.git
Tested with typescript version - v5.4.2, v5.5.2 and v5.6.2
Queries
- Is this expected behaviour, where typecheck would not typecheck when we have a cache and a file is deleted
- Is there a known way to mitigate this issue
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.
Direzione di ricerca
Inizia dal repository di riproduzione collegato e ispeziona tsconfig.project-references.json, il tsconfig di base e la configurazione dei progetti bar/foo. Esegui yarn tsc -b tsconfig.project-references.json -v, elimina packages/bar/src/clean.ts ed esegui nuovamente la build. Il lavoro è completato quando viene determinato e documentato se la seconda build debba segnalare il file mancante importato tramite percorso, con una coverage del comportamento osservato se appropriato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- build-system, compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100