fix(devtools): resolve ts7006 implicit-any bug - #333
Open
vedanshshetti wants to merge 4 commits into
Open
Conversation
Contributor
|
@vedanshshetti is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
| allowDockToggle: props.allowDockToggle, | ||
| }); | ||
| unsubSelection = selection.subscribe((key) => { | ||
| unsubSelection = selection.subscribe((key: unknown) => { |
Contributor
There was a problem hiding this comment.
|
|
||
| // Highlight in the host DOM as the selection changes. | ||
| const unsubSelection = selection.subscribe((key) => { | ||
| const unsubSelection = selection.subscribe((key: unknown) => { |
Contributor
There was a problem hiding this comment.
Suggested change
| const unsubSelection = selection.subscribe((key: unknown) => { | |
| const unsubSelection = selection.subscribe((key) => { |
Annotating the selection.subscribe callback parameter as (key: unknown) breaks the type-check because highlightElement requires a string, but unknown narrowed by if (key) becomes {}.
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
This PR fixes TypeScript strict‑mode errors (
TS7006: Parameter 'key' implicitly has an 'any' type) in the internal devtools packages by explicitly typing the selection.subscribe callback parameter as unknown. The issue appeared in both the React and Solid devtools implementations.Changes
React_devtools_fix
Updated
unsubSelection = selection.subscribe((key) => { ... })tounsubSelection = selection.subscribe((key: unknown) => { ... })in packages/devtools-react/src/index.tsx.
Solid_devtools_fix
Applied the same fix in packages/devtools-solid/src/index.tsx for consistency.
Why this matters
Each item begins with a Guided Link.
TS_strict_mode
TypeScript’s strict mode flags untyped callback parameters as implicit any, which breaks builds and reduces type safety.
Internal_consistency
Both devtools implementations now use the same safe typing strategy, preventing future strict‑mode regressions.
Zero_runtime_change
This PR only affects type annotations. No runtime behavior or public API surface is changed.
Scope
This PR is strictly internal cleanup.
It does not modify logic, behavior, or user‑facing features.