-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Restrict types for Spring and Tween #14862
base: main
Are you sure you want to change the base?
Conversation
Closes Improve Spring data typing, or improving it so it doesn't bother about unsupported data types sveltejs#14851
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR in draft mode. Kindly let me know if this is something the core team would like to pursue. If so, I'll follow any additional instructions I am given and take the PR out of draft mode. Thanks!
One thing to account for is that arrays containing numbers are supported, so perhaps export type MotionRecord = {
[x: string | number]: MotionPrimitive | MotionRecord | (MotionPrimitive | MotionRecord)[];
} | (MotionPrimitive | MotionRecord)[] |
It's already accounted for. T extends from |
Maintainers, I remember Rich removed the throwing part when the type is not springable in the Spring class. I suppoose that this PR needs ammending to account for this (typing is no longer needed for Do let me know if you want to proceed with this for |
Closes Improve Spring data typing, or improving it so it doesn't bother about unsupported data types #14851
This PR introduces the
MotionPrimitive
andMotionRecord
data types to accurately reflect what the algorithms of the Spring and Tween classes can handle.The alternative would be to remove the throwing whenever an unsupported data type is found, but I suppose that is a breaking change and if that's the preferred route, then it would have to wait for Svelte v6. Therfore, this PR should greatly increase the accuracy of Intellisense when using Spring and Tween.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint