镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Stale errors in tsbuildinfo file #42769

Description

@dko-slapdash

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.

  1. I opened client/dist/tsconfig.tsbuildinfo in a text error, and I see this error there.
  2. I manually edited this error in tsconfig.tsbuildinfo file (semanticDiagnosticsPerFile), and the output of ttsc --watch in client/ changed accordingly - i.e. I proved that tsc reads this error from tsconfig.tsbuildinfo and skips compilation for some reason.
  3. shared/dist/t.d.ts is correct. I tried to 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?).
  4. It looks like that if I remove the error objects from semanticDiagnosticsPerFile section of tsconfig.tsbuildinfo, the build succeeds.

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=true

Could 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.

Activity

  1. sheetalkamat commented on Mar 2, 2021

    @sheetalkamat
    Member

    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.

  2. added
    Needs More InfoThe issue still hasn't been fully clarified
    and removed
    Needs InvestigationThis issue needs a team member to investigate its status.
    on Mar 2, 2021
  3. dko-slapdash commented on Mar 2, 2021

    @dko-slapdash
    Author

    Sheetal Nandi (@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?

  4. 6 remaining items

  5. adrienharnay commented on Apr 1, 2022

    @adrienharnay

    Hello Sheetal Nandi (@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

  6. added a commit that references this issue on Apr 7, 2022
    768f7ef
  7. added 7 commits that reference this issue on Apr 11, 2022
    e638aec
    2bfa980
    7a4fd26
    ff1c27b
    61044e9
    4c3ca2a
    87a7112
  8. added a commit that references this issue on Apr 21, 2022
    45faac7
  9. added a commit that references this issue on Apr 22, 2022
    7336aad
  10. added a commit that references this issue on Jun 8, 2022
    b8f6488
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Fix AvailableA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions