Skip to content

fix: resolve svelte-check errors in 10 core mark components#477

Merged
gka merged 4 commits into
mainfrom
types/fix-core-types
Feb 21, 2026
Merged

fix: resolve svelte-check errors in 10 core mark components#477
gka merged 4 commits into
mainfrom
types/fix-core-types

Conversation

@gka

@gka gka commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

Resolves #413, #414, #415, #416, #426, #431, #433, #434, #454, and #463.

Summary

  • Fixes all TypeScript errors in 10 core mark components, reducing total svelte-check errors from 781 → 732
  • All 666 tests continue to pass

Files fixed (0 errors each after this PR):

  • Area.svelte, Arrow.svelte, AxisX.svelte, AxisY.svelte
  • ColorLegend.svelte, Frame.svelte, GridX.svelte, GridY.svelte
  • helpers/AreaCanvas.svelte, helpers/Marker.svelte, helpers/TrailCanvas.svelte

Key fix patterns applied

  • Generic Datum boundary: as any casts when spreading options into <Mark> or sub-components where Datum parameter types are incompatible
  • getPlotDefaults() spread: Store result in a local variable before conditionally spreading (true | Partial<...> | undefined cannot be narrowed across two separate function calls)
  • resolveProp null returns: Use ?? fallback instead of relying on the return type (the _defaultValue: K | null parameter prevents TypeScript from inferring non-null)
  • Scaled channel values: Use d.x1 ?? 0 etc. since ScaledDataRecord channel values can be undefined
  • d3-shape generics: Cast callWithProps(area, []) result to Area<ScaledDataRecord> since d3 defaults to Area<[number, number]>
  • AxisX/Y: Add 'textAnchor' to Omit; access getPlotDefaults().numberFormat directly (it's top-level, not under axis)

Test plan

  • npx svelte-check shows 0 errors in all modified files
  • All 666 Playwright tests pass (pnpm test)

🤖 Generated with Claude Code

Fix TypeScript errors in Area, Arrow, AxisX, AxisY, ColorLegend,
Frame, GridX, GridY, AreaCanvas, Marker, and TrailCanvas marks.

Key fixes:
- Add `as any` casts at generic Datum boundary in Mark/subcomponent spreads
- Use local variables for getPlotDefaults() results before spreading
  (fixes "Spread types may only be created from object types" errors)
- Use `?? fallback` for resolveProp null returns instead of arithmetic
- Add null guards for optional scale channel values (d.x1 ?? 0 etc.)
- Cast d.datum to Datum type in templates where needed
- Fix Area: import type Area from d3-shape; cast callWithProps result
- Fix AxisX/Y: add 'textAnchor' to Omit; use getPlotDefaults().numberFormat
  directly; cast derived objects as AxisXMarkProps/AxisYMarkProps
- Fix ColorLegend: cast tickFormat as any for x prop
- Fix Frame: use local variable for plotDefaults.frame before spreading
- Fix Arrow: import SweepFunc type; add ?? fallback for headAngle/headLength

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@netlify

netlify Bot commented Feb 21, 2026

Copy link
Copy Markdown

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 1031efa
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/6999e5ce9cdae90008ff2166
😎 Deploy Preview https://deploy-preview-477--svelteplot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions

Copy link
Copy Markdown

📦 Preview package for this PR is published!

Version: 0.10.3-pr-477.0

Install it with:

npm install svelteplot@pr-477
# or install the specific version
npm install [email protected]

@github-actions

Copy link
Copy Markdown

📦 Preview package for this PR is published!

Version: 0.10.3-pr-477.1

Install it with:

npm install svelteplot@pr-477
# or install the specific version
npm install [email protected]

@github-actions

Copy link
Copy Markdown

📦 Preview package for this PR is published!

Version: 0.10.3-pr-477.2

Install it with:

npm install svelteplot@pr-477
# or install the specific version
npm install [email protected]

@github-actions

Copy link
Copy Markdown

📦 Preview package for this PR is published!

Version: 0.10.3-pr-477.3

Install it with:

npm install svelteplot@pr-477
# or install the specific version
npm install [email protected]

@gka gka merged commit dcb4c77 into main Feb 21, 2026
9 checks passed
@gka gka deleted the types/fix-core-types branch February 21, 2026 17:36
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.

[svelte-check] Fix errors in src/lib/marks/Area.svelte

1 participant