Skip to content

feat: build the projects a typescript config file references - #336

Merged
alexander-akait merged 1 commit into
mainfrom
feat/build-project-references
Sep 13, 2026
Merged

feat: build the projects a typescript config file references#336
alexander-akait merged 1 commit into
mainfrom
feat/build-project-references

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Sep 13, 2026

Copy link
Copy Markdown
Member

Summary

A tsconfig.json that lists only references describes an empty program of its own — measured on a two-project solution, the check parsed it, found 0 files and 0 diagnostics, and reported nothing. build: true builds the graph the way tsc -b does and reports what every project in it finds.

A reference is read through the declarations the referenced project publishes, so building one is how the next is checked at all. The build therefore writes each project's .d.ts and its .tsbuildinfo and nothing else: the JavaScript stays webpack's to write, and a later tsc -b of your own still emits it (verified both ways round — a declaration-only build leaves existing output alone, and a full build after one still emits). noEmit is not an option here: TypeScript itself refuses it with TS6310, Referenced project may not disable emit.

What a check writes is now also kept out of the folders it hands the watcher (#334), so a build is not its own trigger.

The cost is a tsc -b pass rather than the kept program of #332. Over five projects and 205 files:

state
nothing built yet 573 ms
up to date 4–8 ms
one file changed 258 ms
an error standing ~200 ms every rebuild

The last row is tsc -b semantics: a project that fails is never up to date, so it is checked again each time. reportAs: "log" (#331, #333) takes that off the rebuild's critical path for anyone who would rather not wait.

Rebased onto main now that #335 has landed, so this is one commit again. #337 sits on top of this one.

What kind of change does this PR introduce?

feat

Did you add tests for your changes?

Yes — test/typescript/references.test.js over a new two-project solution fixture: nothing reported unbuilt, the error a built solution finds, the declarations published and no JavaScript written, the folders watched and the written ones not, an unreadable project in the graph, and a fix clearing the report.

Does this PR introduce a breaking change?

No — a new option, off by default.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

Documented in README.md under the TypeScript check.

Use of AI

Claude Code wrote the change, the tests and this description, and ran the measurements above; I reviewed all of it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy

@alexander-akait
alexander-akait changed the base branch from feat/ignore-diagnostics to main September 13, 2026 20:32
A `tsconfig.json` that lists only `references` describes an empty program
of its own, so a solution reported nothing at all. `build: true` builds
the graph the way `tsc -b` does and reports what every project in it
finds.

A reference is read through the declarations the referenced project
publishes, so the build writes each project's `.d.ts` and its
`.tsbuildinfo` and nothing else — the JavaScript stays webpack's, and a
later `tsc -b` of your own still emits it. What a check writes is now
kept out of the folders it hands the watcher, so a build is not its own
trigger.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
@alexander-akait
alexander-akait force-pushed the feat/build-project-references branch from 29caa91 to 3748fba Compare September 13, 2026 20:56
@alexander-akait
alexander-akait merged commit 358ec0f into main Sep 13, 2026
13 checks passed
@alexander-akait
alexander-akait deleted the feat/build-project-references branch September 13, 2026 21:04
This was referenced Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant