Repository navigation
Conversation
Use the keys of the remapped state registry directly for the Node and client overloads. The registry already produces string keys. TypeScript 7 rejects the extra intersection when checking the published indexed access types.
|
@SaKaNa-Y is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
|
👁️🗨️ Review this pull request with grouped, summarized diffs at: raw result💭 analyzed by {
"headSha": "58cd0fc9b4a1c85da0c8f89065c490de1ea45538",
"result": {
"overallSummary": "Fixes a TypeScript 7 regression (TS2536) in devframe's scoped `sharedState` RPC method by restructuring the generic constraint so the key type is intersected with `string` on the parameter rather than on the type parameter itself. Behavior and emitted JS are unchanged; only `.d.ts` output differs, backed by a new type-level regression test and updated snapshots.",
"groups": [
{
"key": "type-fix",
"label": "Scoped shared state type fix",
"summary": "Rewrites the `sharedState` overload generic constraint from `keyof ScopedSharedStates<NS> & string` to `keyof ScopedSharedStates<NS>` with `T & string` on the parameter, avoiding a TS2536 error under TypeScript 7 while still rejecting non-string keys at the call site.",
"category": "api",
"filePaths": [
"packages/devframe/src/client/scope.ts",
"packages/devframe/src/types/scope.ts"
],
"critical": true
},
{
"key": "tests",
"label": "Tests and snapshots",
"summary": "Adds a regression type test covering both scoped RPC entry points and both key styles (fixed and pattern), and updates the declaration snapshots to match the new overload signature.",
"category": "tests",
"filePaths": [
"packages/devframe/test/scoped-shared-state.test-d.ts",
"tests/__snapshots__/tsnapi/devframe/client.snapshot.d.ts",
"tests/__snapshots__/tsnapi/devframe/index.snapshot.d.ts",
"tests/__snapshots__/tsnapi/devframe/types.snapshot.d.ts"
],
"fileNotes": [
{
"path": "packages/devframe/test/scoped-shared-state.test-d.ts",
"text": "New `test-d.ts` verifies that numeric/symbol keys are rejected and that string keys still correctly infer the registered state type, including for namespaces with a template-string index signature."
}
]
}
],
"schemaVersion": 1,
"source": "llm",
"generatedAt": "2026-11-24T08:20:44.889Z",
"model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
"locale": "en"
}
} |
Keep the type parameter directly constrained by the scoped map so TypeScript 7 can index it. Require a string at the call site because a namespace with a string index signature also admits numeric keys in keyof.
SaKaNa-Y
marked this pull request as ready for review
November 24, 2026 08:21
This branch has not been deployed
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.
Closes #508
Summary
Vite's package build reports TS2536 when TypeScript 7 checks the scoped
sharedStatedeclaration indevframe@1.4.0. The client entry has the same error. TypeScript cannot use the constrained type parameter to index the scoped state map.Use the map's keys directly to look up the state type. Keep the string requirement on the argument. A namespace registered with a template string index signature can have numeric keys in
keyof, but the runtime expects a string.Evidence
Merge Danger
Door: Two-way. Reverting restores the TS7 declaration error.
Blast Radius: Types. All 87 emitted JavaScript files were byte-identical when built from the base and updated source in the same directory.