Skip to content

deps(js): take TypeScript 6, and the TS5107 that hides 64 errors behind 1 - #338

Merged
scttfrdmn merged 10 commits into
mainfrom
deps/typescript-6
Aug 4, 2026
Merged

scttfrdmn merged 10 commits into
mainfrom
deps/typescript-6

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Closes #328.

Base is deps/eslint-10-flat-config (#335), not main — both PRs change sdks/javascript/package.json and its lockfile, and #335 is already on its third CHANGELOG conflict resolution. This retargets to main automatically when #335 merges.

The change

typescript ^5→^6, typedoc ^0.24→^0.28.20, jest and @types/jest ^29→^30, plus two tsconfig.json keys. ts-jest stays at ^29.1.0 — its 29.4.12 already peers <7, so it admits 6.

The trap, which is the reason this is worth a careful PR

TypeScript 6 deprecates moduleResolution: "node" and raises TS5107. But TS5107 is a config-level error, so tsc exits before typechecking any source. It reports 1 error — which reads like a nearly-clean bump. 64 wait behind it. A partial fix here looks like a regression rather than progress.

The 64 are all @types/node failing to resolve; TypeScript 6 no longer auto-includes it. Bumping @types/node does not help — typesVersions-only, no exports map.

Mutation-verified, not assumed

tsconfig tsc --noEmit
as committed 0 errors
− ignoreDeprecations 1 — exactly the TS5107
− types: ["node"] 64 — 29×TS2584, 18×TS2591, 10×TS2304, 4×TS7006, 2×TS2339, 1×TS2503

#328 predicted 63 from a scratch copy. The real number here is 64. Small, but it is the difference between a measured claim and a carried-over one.

moduleResolution deliberately does not move: it cannot move alone (TS5110 — module must move too), and moving both makes ts-jest warn TS151002 on every suite. Keeping module: commonjs and acknowledging the deprecation is the quieter option; both keys carry comments saying so, since tsconfig.json is JSONC and takes real comments.

Gates, from a clean npm ci

sdk-metrics installs with npm ci, so verifying against my incrementally-updated node_modules would not have proven anything. From rm -rf node_modules && npm ci:

Running that ungated step found a second, unrelated defect

markdownFiles() in internal/config/docs_test.go said "every tracked markdown file" in its doc comment and then walked the filesystem with a skip-list. So TypeDoc's output was scanned as repository documentation — and TypeDoc copies CONTRIBUTING.md into docs/media/, where the copy's relative links resolve against the wrong base directory. TestDocumentedLinksResolve failed on a link that is correct in the original file.

Now git ls-files, which inherits .gitignore and cannot drift from it, where a skip-list can only ever name generators someone has already run — the same shape as every other "nothing had run this" finding in this release. /sdks/javascript/docs/ is gitignored too.

Coverage is unchanged where it matters: 38 tracked documents checked, same as before. The two files dropped are both generated — TypeDoc's copy and a .pytest_cache/README.md the old walk had also been reading. Mutation-checked by appending a deliberate broken link to README.md and confirming the test still fails on it.

Dependabot's #309 bumped eslint to 10.x alone. That could not be merged: eslint 10
does not read package.json's `eslintConfig` block at all, so the bump would have
silently discarded every rule this SDK lints with — including the config fix that
had just landed for the same file — and left `npm run lint` either erroring or
running with defaults, depending on how it was invoked.

So the block moves to sdks/javascript/eslint.config.js, as a port and not a
rewrite: same five rules, same severities. Three translation points are recorded
in the file, because none of them is visible from a version diff — flat config has
no `extends`, `env` splits into `globals` plus `ecmaVersion`, and `.eslintignore`
is no longer read so `dist/**` has to be an `ignores` entry or the emitted
JavaScript gets linted as source.

typescript-eslint 8 then found two real defects, because it defaults
`caughtErrors: 'all'` and reports every discarded catch binding. Six of the eight
sites were deliberate and are renamed `_error`. The other two threw a new error
while dropping the cause of the original:

  - findBinary() reported every execSync('which objectfs') failure as "not found
    in PATH", which sends the reader to the wrong place when the cause was a
    permissions failure or an unwritable cwd.
  - prepareMountPoint() reported every `access` rejection as "insufficient
    permissions", including ENOENT for a mount point that does not exist.

Both now include the cause. Test files are linted now, which they were not
before, and that found a third thing: index.test.ts disabled
`@typescript-eslint/no-var-requires`, a rule typescript-eslint 8 renamed to
`no-require-imports`, so the directive had been suppressing nothing.

Verified: `npm run lint` 0 errors / 19 warnings (all no-explicit-any, `warn` by
design), `npm run build` emits dist/, `npm test` 65/65. The config itself was
mutation-checked — an unused binding and a formatting violation were introduced
and both reported as errors, so the rules are enforced rather than merely present.
CHANGELOG conflict only: #334's docs-site and codeql-v4 entries landed in the
same 'Fixed' section this branch adds its #309 entry to. Both kept, in the
order main has them.
CHANGELOG conflict only, third time: #291 (okhttp) and the docs-platform
lockfile both landed entries in the same 'Fixed' section this branch adds #309
to. All kept, in main's order.
…nd 1

Closes #328. typescript ^5->^6, typedoc ^0.24->^0.28.20, jest and @types/jest
^29->^30, plus two tsconfig keys. ts-jest stays at ^29.1.0 — its 29.4.12
already peers <7, so it admits 6.

The first key is the trap. TS6 deprecates moduleResolution: "node" and raises
TS5107, but TS5107 is a CONFIG-level error, so tsc exits before typechecking
any source. It reports 1 error, which reads like a nearly-clean bump; 64 wait
behind it, all @types/node no longer being auto-included.

Both keys mutation-checked rather than assumed: removing ignoreDeprecations
gives exactly the 1 TS5107; removing types:[node] gives 64 across six codes
(29 TS2584, 18 TS2591, 10 TS2304, 4 TS7006, 2 TS2339, 1 TS2503). #328 predicted
63 from a scratch copy — the real number here is 64.

moduleResolution deliberately does not move: it cannot move alone (TS5110), and
moving it with module makes ts-jest warn TS151002 on every suite.

Verified from a clean npm ci, since sdk-metrics installs that way: tsc 0
errors, 65 tests in 4 suites, lint 0 errors / 19 warnings, and npm run docs —
the one step of the four CI does not gate.

Running that ungated step found a second thing. markdownFiles() walked the
filesystem while its doc comment said 'tracked', so TypeDoc's output was
scanned as repository documentation; it copies CONTRIBUTING.md into docs/media/
where the copy's relative links resolve against the wrong base. Now git
ls-files, which inherits .gitignore and cannot drift from it. Same 38 real
documents; the two dropped are generated, TypeDoc's copy and a .pytest_cache
README the old walk had also been reading.
@scttfrdmn
scttfrdmn changed the base branch from deps/eslint-10-flat-config to main August 4, 2026 04:07
Three conflicts, all the same shape: #335 (eslint 10) merged to main, and this
branch was cut from #335's tip, so package.json, its lockfile and CHANGELOG all
carry both sets of changes. Ours in every case — main's side is the pre-bump
value this PR exists to replace.

Verified the merged manifest keeps both stacks: typescript ^6, typedoc ^0.28.20,
jest and @types/jest ^30 from here; eslint ^10.8.0, typescript-eslint ^8.66.0,
globals ^17.9.0 from #335. Lockfile confirmed in sync via
npm install --package-lock-only producing no further diff.

Re-ran the gates from a clean npm ci after resolving, not before: tsc 0 errors,
65 tests, lint 0 errors / 19 warnings.
Two golangci-lint findings on the git ls-files switch, both real:

  noctx     — os/exec.Command must not be called, use CommandContext. t.Context()
              ties the subprocess to the test's lifetime, so a hung git cannot
              outlive the test that spawned it.
  modernize — ranging over strings.SplitSeq avoids materializing the whole slice.

Neither suppressed. Verified with the command CI runs,
golangci-lint run --new-from-merge-base=origin/main: 0 issues.

Also documents why -z is there: a path may contain a newline, and git ls-files
without -z quotes those instead of emitting them, which would need unquoting to
match the filesystem.
@scttfrdmn
scttfrdmn enabled auto-merge (squash) August 4, 2026 04:17
CHANGELOG conflict only: #337 added the #214 lockfile entry to the same
`### Fixed` section this branch adds the TypeScript 6 entry to. Both kept,
in main-first order.
@scttfrdmn
scttfrdmn merged commit 405d93a into main Aug 4, 2026
25 checks passed
@scttfrdmn
scttfrdmn deleted the deps/typescript-6 branch September 20, 2026 05:25
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.

Bump the JavaScript SDK to TypeScript 6: two tsconfig keys, and the TS5107 that hides 63 errors behind 1

1 participant