You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #14840 made me suggest the following typing for the Spring class:
+ type MotionPrimitive = number | Date;+ interface MotionRecord {+ [x: string]: MotionPrimitive | MotionRecord | (MotionPrimitive | MotionRecord)[];+ };- export class Spring<T> {+ export class Spring<T extends MotionRecord['']> {
This is because the current Spring logic throws if say, a value of type string is found in its recursive logic. But what if the throwing doesn't happen?
Describe the proposed solution
Two possible options:
We improve the typing around the Spring class as proposed here.
We remove the throwing part and instead the value is simply ignored (this ELSE statement).
If the second option, then type parameter T doesn't require constraining and people can pass anything as value to the spring object, but then documentation must be updated to make devs aware that only numbers or dates can be sprung.
Importance
nice to have
The text was updated successfully, but these errors were encountered:
webJose
changed the title
Improve Spring and Tween's data typing, or improving it so it doesn't bother about unsupported data types
Improve Spring data typing, or improving it so it doesn't bother about unsupported data types
Dec 28, 2024
Describe the problem
Issue #14840 made me suggest the following typing for the
Spring
class:This is because the current Spring logic throws if say, a value of type
string
is found in its recursive logic. But what if the throwing doesn't happen?Describe the proposed solution
Two possible options:
Spring
class as proposed here.If the second option, then type parameter
T
doesn't require constraining and people can pass anything as value to the spring object, but then documentation must be updated to make devs aware that only numbers or dates can be sprung.Importance
nice to have
The text was updated successfully, but these errors were encountered: