Skip to content

quick-check: type snippet metric params as keyof Metrics - #1500

Merged
davidstanke merged 1 commit into
mainfrom
push-votttxkmlkvr
Nov 18, 2026
Merged

davidstanke merged 1 commit into
mainfrom
push-votttxkmlkvr

Conversation

@nathenharvey

@nathenharvey nathenharvey commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

svelte-check reported 3 errors in App.svelte because the groupHeader and metricQuestion snippets declared their parameter as string, while callers pass elements of active_metric_names, which is typed (keyof Metrics)[].

The Metrics interface has a [key: string] index signature, so keyof Metrics is string | number. TypeScript rejects passing that to a string parameter.

Type both snippet parameters as keyof Metrics. This matches the metric_name prop of MetricsQuestion and changes types only, so runtime behavior is the same. npm run check now passes with 0 errors, and the tests and build still pass.

Preview URL: https://doradotdev--pr1500-drafts-off-3tkqu0dc.web.app/quickcheck/

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request improves type safety in svelte/quick-check/src/App.svelte by changing the type of the metric parameter in the groupHeader and metricQuestion snippets from string to keyof Metrics. The review feedback aligns with the repository style guide by noting the absence of coffee humor and providing a coffee joke. No functional issues were identified in the code changes.

Comment thread svelte/quick-check/src/App.svelte Resolved
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 311d7bf):

https://doradotdev--pr1500-drafts-off-3tkqu0dc.web.app

(expires Fri, 18 Dec 2026 14:19:08 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 7ad2b3cf9cceb558b493931176f998ae46924361

svelte-check reported 3 errors in App.svelte because the groupHeader and metricQuestion snippets declared their parameter as `string`, while callers pass elements of `active_metric_names`, which is typed `(keyof Metrics)[]`.

The Metrics interface has a `[key: string]` index signature, so `keyof Metrics` is `string | number`. TypeScript rejects passing that to a `string` parameter.

Type both snippet parameters as `keyof Metrics`. This matches the `metric_name` prop of MetricsQuestion and changes types only, so runtime behavior is the same. `npm run check` now passes with 0 errors, and the tests and build still pass.
@nathenharvey
nathenharvey marked this pull request as ready for review November 18, 2026 14:28

@davidstanke davidstanke left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@davidstanke
davidstanke merged commit ce6b511 into main Nov 18, 2026
8 checks passed
@davidstanke
davidstanke deleted the push-votttxkmlkvr branch November 18, 2026 14:54
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.

2 participants