Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/devtools-react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export function JsonRenderDevtools(props: JsonRenderDevtoolsProps) {
handleRef.current = panel;

// Highlight in the host DOM as the selection changes.
const unsubSelection = selection.subscribe((key) => {
const unsubSelection = selection.subscribe((key: unknown) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {}.

Fix on Vercel

if (key) highlightElement(key);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/devtools-solid/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function JsonRenderDevtools(props: JsonRenderDevtoolsProps) {
reserveSpace: props.reserveSpace,
allowDockToggle: props.allowDockToggle,
});
unsubSelection = selection.subscribe((key) => {
unsubSelection = selection.subscribe((key: unknown) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
unsubSelection = selection.subscribe((key: unknown) => {
unsubSelection = selection.subscribe((key) => {

selection.subscribe callback param typed (key: unknown) fails type-check because narrowed {} is not assignable to highlightElement's string parameter (TS2345)

Fix on Vercel

if (key) highlightElement(key);
});
releaseActive = markDevtoolsActive();
Expand Down