fix: resolve svelte-check errors in 10 core mark components#477
Merged
Conversation
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]>
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-477
# or install the specific version
npm install [email protected] |
|
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-477
# or install the specific version
npm install [email protected] |
|
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-477
# or install the specific version
npm install [email protected] |
|
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-477
# or install the specific version
npm install [email protected] |
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.
Resolves #413, #414, #415, #416, #426, #431, #433, #434, #454, and #463.
Summary
svelte-checkerrors from 781 → 732Files fixed (0 errors each after this PR):
Area.svelte,Arrow.svelte,AxisX.svelte,AxisY.svelteColorLegend.svelte,Frame.svelte,GridX.svelte,GridY.sveltehelpers/AreaCanvas.svelte,helpers/Marker.svelte,helpers/TrailCanvas.svelteKey fix patterns applied
as anycasts when spreadingoptionsinto<Mark>or sub-components whereDatumparameter types are incompatiblegetPlotDefaults()spread: Store result in a local variable before conditionally spreading (true | Partial<...> | undefinedcannot be narrowed across two separate function calls)resolvePropnull returns: Use?? fallbackinstead of relying on the return type (the_defaultValue: K | nullparameter prevents TypeScript from inferring non-null)d.x1 ?? 0etc. sinceScaledDataRecordchannel values can beundefinedd3-shapegenerics: CastcallWithProps(area, [])result toArea<ScaledDataRecord>since d3 defaults toArea<[number, number]>'textAnchor'toOmit; accessgetPlotDefaults().numberFormatdirectly (it's top-level, not underaxis)Test plan
npx svelte-checkshows 0 errors in all modified filespnpm test)🤖 Generated with Claude Code