Repository navigation
Upgrade to TypeScript 6.0 with the Options excess-property guard fix - #34
Open
kac-axelor wants to merge 2 commits into
Open
kac-axelor wants to merge 2 commits into
kac-axelor wants to merge 2 commits into
Conversation
TS 6.0 preserves the argument's exact shape when inferring generics (microsoft/TypeScript#63515), so the prior T[K]-per-slot guard silently accepted unknown keys at nested depths. Switch to U[K] (the declared shape); a phantom branch keeps T[K] as an inference anchor so Payload<T, U> still narrows to selected fields.
TS 6.0 no longer auto-includes node_modules/@types, so declare types: ["node"] explicitly for the Buffer/process/node:* usage.
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.
Summary
TypeScript 6.0 changes generic inference: the compiler preserves the exact
argument shape when inferring generics (microsoft/TypeScript#63515). That
made the
Options<>per-slotT[K]check compare the inferred value againstitself, so unknown keys nested inside
where/select/orderBy/createwere silently accepted under 6.0. This PR upgrades to 6.0 with the guard
reworked to stay inference-proof, preserving full 5.9 behavior.
What the guard fix restores
Given an invalid query — an unknown key nested in the options, e.g.
where: { title: { name: "x", bogusR: 1 } }:Commits
Ordered so every commit is green — the guard rework behaves identically
under 5.9, so it lands first:
Options<>(each slot typed from the expected shape, with a never-matched marker key as the inference handle)typescript^5.9.3 → ^6.0.3;types: ["node"]in tsconfig (6.0 no longer auto-includes everything undernode_modules/@types)Validation
pnpm test(unit)pnpm buildpnpm test:e2e(real PostgreSQL)