Skip to content

ref element type not inferred correctly #5

Description

@rafgraph

Hi, great library, thanks for creating it! I'm using it in React Interactive

Using the Heading forwardRef example in the readme the ref element type implicitly is any:
For a live reproduction see: https://codesandbox.io/s/polymorphic-inferred-ref-type-zqyl6

<Heading
  as="h1"
  color="green"
  // error: Parameter 'element' implicitly has an 'any' type.
  ref={(element) => {}}
>
  As h1
</Heading>

Note that when creating a props object to pass to Heading the ref element type is inferred correctly:

const propsForHeading: HeadingProps<"h1"> = {
  // element type is inferred correctly
  ref: (element) => {},
  children: "Heading using propsForHeading"
};

...

<Heading {...propsForHeading} />

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions