feat: add yarn typecheck script#9109
Draft
cryptodev-2s wants to merge 1 commit into
Draft
Conversation
ab1374e to
63a6161
Compare
Adds `yarn typecheck` (root + per-package) that runs `tsc --noEmit` over each package's dev tsconfig, including test files. Closes the gap where `yarn build:types` excluded `**/*.test.ts` and ESLint doesn't surface module-resolution errors, letting test-file dangling type imports through CI (see PR MetaMask#8012). - Move `composite: true` from `tsconfig.base.json` to `tsconfig.packages.build.json` (the only consumer of project references is `tsc --build tsconfig.build.json`). - Add `skipLibCheck: true` to `tsconfig.base.json` to match the build config and silence `node_modules` `.d.cts` noise. - Clear `references: []` from per-package dev tsconfigs (they were only used by composite mode); build configs keep theirs. - Strip leftover `outDir`/`rootDir` from `core-backend` dev tsconfig. - Enforce per-package `typecheck` script via yarn constraints. - Fix five test-file dangling type imports surfaced by the new script (account-tree, multichain-account-service, ai, phishing, multichain-network).
63a6161 to
f0daa44
Compare
jpuri
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
yarn build:typesexcludes**/*.test.tsand ESLint doesn't surface TypeScript module-resolution errors, so test-file danglingimport typedeclarations slip through CI — the gap that produced #8012.This PR adds
yarn typecheck(per-package + root fan-out) that runstsc --noEmitover each package's dev tsconfig with test files included, so renames/removals of exported types are caught before merge.To keep this to a single dev tsconfig per package (no parallel
tsconfig.typecheck.json):composite: truemoves fromtsconfig.base.json→tsconfig.packages.build.json(the only consumer wastsc --build tsconfig.build.json).skipLibCheck: trueadded totsconfig.base.jsonto match the build config.references: [](they were only meaningful under composite mode; build configs keep theirs intact).core-backenddev tsconfig drops leftoveroutDir/rootDir.typecheckscript enforced across all non-private packages viayarn.config.cjsconstraint.Five test-file dangling-import bugs that the new script surfaced are fixed here too:
account-tree-controller,multichain-account-service,ai-controllers,phishing-controller,multichain-network-controller.The script is not wired into
yarn lintyet — runningyarn typecheckonmaincurrently surfaces ~860 pre-existing errors across other packages, which need to be triaged by package owners before it can be CI-gating.References
Checklist
Note
Low Risk
Tooling and test-only type/import fixes; no production runtime behavior changes. Large tsconfig churn is mechanical and build configs keep composite references.
Overview
Adds
yarn typecheckat the repo root to fan outtsc --noEmitacross non-private workspaces, with each package getting a matchingtypecheckscript (enforced inyarn.config.cjs). Devtsconfig.jsonfiles no longer use projectreferences;compositeandskipLibCheckare shifted so dev typechecking can include tests without a separatetsconfig.typecheck.json.Several test-only fixes align with stricter checking: renamed snap messenger type import,
KeyringCapabilitiesfrom@metamask/keyring-api/v2,digestIdon AI digest mocks, XLM account type in multichain network tests, and an extra argument onAddressBookController:stateChangepublish in phishing tests.Reviewed by Cursor Bugbot for commit ab1374e. Bugbot is set up for automated code reviews on this repo. Configure here.