Skip to content

fix(useSpring): infer return type from source argument#251

Merged
rick-hup merged 1 commit intomasterfrom
fix/use-spring-type-inference
Apr 6, 2026
Merged

fix(useSpring): infer return type from source argument#251
rick-hup merged 1 commit intomasterfrom
fix/use-spring-type-inference

Conversation

@rick-hup
Copy link
Copy Markdown
Collaborator

@rick-hup rick-hup commented Mar 23, 2026

Summary

  • Add overload signatures to useSpring so the return type is inferred from the source argument
  • MotionValue<string> | string → returns MotionValue<string>
  • MotionValue<number> | number → returns MotionValue<number>

Test plan

  • Verify TypeScript correctly infers MotionValue<string> when passing a string source
  • Verify TypeScript correctly infers MotionValue<number> when passing a number source

Add overload signatures so useSpring returns MotionValue<string> when
source is string/MotionValue<string>, and MotionValue<number> when
source is number/MotionValue<number>.
@rick-hup rick-hup merged commit 6306078 into master Apr 6, 2026
2 checks passed
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.

1 participant