-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stale errors in tsbuildinfo file #42769
Comments
Please provide concrete repro steps with source code and changes that need to be followed step by step rather than just describing the issue. Without steps its hard to understand whats going on and whats expected. |
@sheetalkamat That’s the problem, I can’t provide any repro steps, the effect is extremely unstable. Maybe you could provide some hints/guesses at least, how does the described behavior look like, knowing how it works internally? |
We get something similiar. We cannot share the repo it happens in - its 800k lines of proprietary code. I delete the cache and then the error disappears. In our case its always generics. In case it helps this is the most recent case:
Without giving you the whole source code, is there any way to help define what the issue is? |
Hello @sheetalkamat , I believe the problem I am facing today is the same as this issue, and I have a very simple reproduction for it: https://github.com/adrienharnay/typescript-buildinfo-bug-repro |
…, everything needs update in signature and dts emit Fixes #42769
…, everything needs update in signature and dts emit Fixes #42769
…, everything needs update in signature and dts emit Fixes #42769
…, everything needs update in signature and dts emit Fixes #42769
…, everything needs update in signature and dts emit Fixes #42769
…, everything needs update in signature and dts emit Fixes #42769
…, everything needs update in signature and dts emit Fixes #42769
…, everything needs update in signature and dts emit Fixes #42769
…, everything needs update in signature and dts emit (microsoft#48600) * Add test * Renames * More refactoring * If we are updating dts of any of the file and it affects global scope, everything needs update in signature and dts emit Fixes microsoft#42769
* Use fixed time for vfs so baselining is consistent * Baseline buildinfos * Write new file text in baseline even if the file wasnt read on the shadow * Remove unnecessary debugger statement * Make sure that incremental correctness is checked with correct writeFile so we know buildInfo was written Also baseline these so its easy to verify the changes * More baselines for the tsbuildinfo * If we are writing dts file and have used file text as version, we can update the signature when doing actual emit * Make WriteFileCallback Api ready for future * Assert that there is only single source file when emitting d.ts file * Add test * Renames * More refactoring * If we are updating dts of any of the file and it affects global scope, everything needs update in signature and dts emit Fixes #42769 * Stacktrace optimization for getModified time in anticipation of using it more than fileExists wherever possible * Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment * Remove unnecessary write file finger print code since its not used at all * Use modified time instead of file existence check * Remove unnecessary getModifiedTime * No need to check for file existence before reading the d.ts file * Do project reference errors before doing input/output file checks * Dont call getModifiedTimes if dts change * Passdown modified time if queried * Use modified time passed through the file watching in tsbuild * Handle force build as separate upto date status * uptodate status worker to read buildinfo and use it to determine upto date ness * No need to update output timestamps if buildinfo will determine uptodateness * Store change file set instead of hasPendingChange to be able to reuse the information * Add test that shows input file is not present * No need to check input time stamp before buildinfo * Keep buildinfos for lifetime of the solution builder and project * Store modified time along with text of buildinfo * Non composite projects dont need to track declaration change time * Pass through buildInfo so we dont have to parse it back * Save dts change time in buildinfo itself * Store dts time for --out in the buildInfo * Store hash of text in the bundle info so it can be verified before manipulating text for fast updates during prepend This helps when text changes during incremental build toggling and we determine we can just manipulate text * Since buildinfo is cached no need to maintain version check state * Store output time stamps for non incremental builds * Revert "Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment" This reverts commit 7e65cd3. * Change verbose messages for upto date status * Reconcile reusable builder state and builder state so there are not two different types that are almost similar looking * Cleanup impliedFormat * Cleanup * Cleanup noEmit option * BuildInfo options emit as a flag * Factor out types for program written in buildinfo with and without bundle emit * No need to store output file stamps if not in watch mode * Cleanup * Test for single watch per file * Fix emit and error update baselines that were duplicate * More refactoring * Only copy emit state fields when backing up to restore if emit fails * Instead of maintaining delta of changes, maintain old state for those changes * Add test to verify build when input file does not change * If version of the input file does not change, dont mark as out of date * Disable lint warning as build fails without the assert * Report aggregate statistics for solution as well as some solution perf numbers * Options solutionDiagnostics instead so that its not too verbose when printing diagnostics * When tsc --build --clean, only remove tsbuildinfo if its incremental build * Revert "Options solutionDiagnostics instead so that its not too verbose when printing diagnostics" This reverts commit 0cf9e30. * Revert "Report aggregate statistics for solution as well as some solution perf numbers" This reverts commit 405d8e9. * Revert "When tsc --build --clean, only remove tsbuildinfo if its incremental build" This reverts commit e4e6672. * Comments in the code * Feedback
It's gonna be a not well-structured bugreport unfortunately, since the effect is hard to reproduce. I hope it's already tracked somewhere (or maybe even addressed).
There is a monorepo with 2 project (say, shared/ and client/), and client/src/a.ts references a string union type
T = "aa" | "bb"
in shared/src/t.ts which is changed frequently. The two projects build independently, so basically client/a.ts references shared/dist/t.d.ts file (i.e. a.ts references *.d.ts in shared/).Often times after adding a new alternative to T and using it in client/, when building client/, we see a compilation errors saying that this alternative is not in type T ("Argument of type T is not assignable ..."), although it's there, and shared/dist/t.d.ts is correct too.
ttsc --watch
in client/ changed accordingly - i.e. I proved that tsc reads this error from tsconfig.tsbuildinfo and skips compilation for some reason.touch shared/dist/t.d.ts
- no luck. I also tried to change its content manually (added a comment) - no luch too (which is weird: the content changed, so the checksum changed too; why didn't tsc notice that?).I.e. it looks like while building client/, tsc for some reason ignores the checksums rechecking in tsconfig.tsbuildinfo and instead just throws the same error it threw before.
What resolves this error is following: if I rename shared/dist/t.d.ts.BAK, then rerun tsc --watch for client and see the new errors, then rename it back - then the error disappears.
Is it an issue in tsc somewhere? Or maybe there is a way to clean all the stale errors in tsbuildinfo file to make sure tsc --watch doesn't rely on them?
P.S.
skipLibCheck=true, composite=true (but shared/ is built independently, no
references
), incremental=true, declaration=trueCould you please provide some more details on how semanticDiagnosticsPerFile works and how does it recheck the files for changes? Because there is definitely a change in t.d.ts file, and this file is mentioned inside the list of files in semanticDiagnosticsPerFile, but despite of that change, tsc still throws the stale error.
The text was updated successfully, but these errors were encountered: