Skip to content

[bug]: render prop within <Spring> is inferred to any #2006

Open
@astj

Description

@astj

Which react-spring target are you using?

  • @react-spring/web
  • @react-spring/three
  • @react-spring/native
  • @react-spring/konva
  • @react-spring/zdog

What version of react-spring are you using?

9.5.5 (maybe 9.5.3+?)

What's Wrong?

When <Spring> component used with render props, TypeScript compiler infers render prop as any, which makes compiler emit errors when noImplicitAny enabled.

With attached CodeSandbox (just using <Spring> component taken from https://react-spring.dev/components/spring#and-this-is-how-you-create-a-chain ), react-spring 9.5.2 works fine and infers styles prop as {opacity: SpringValue<number>, color: SpringValue<string>}. But 9.5.3+ infers it as any.

To Reproduce

Place some <Spring> components using render props in its children with TypeScript.

Expected Behaviour

The render prop in children of <Spring> is inferred to some object reflecting the component's from and to props' structure.

Link to repo

https://codesandbox.io/s/clever-jennings-wo8jet?file=/src/App.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions