Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悶 Type error when use forwardRef in typescript #244

Closed
z22919456 opened this issue Oct 20, 2022 · 2 comments
Closed

馃悶 Type error when use forwardRef in typescript #244

z22919456 opened this issue Oct 20, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@z22919456
Copy link

Description

I have some code like that:
code

It has an type error on ref

Type 'ForwardedRef<HTMLDivElement>' is not assignable to type 'Ref<"div"> | undefined'.
  Type '(instance: HTMLDivElement | null) => void' is not assignable to type 'Ref<"div"> | undefined'.
    Type '(instance: HTMLDivElement | null) => void' is not assignable to type '(instance: "div" | null) => void'.
      Types of parameters 'instance' and 'instance' are incompatible.
        Type '"div" | null' is not assignable to type 'HTMLDivElement | null'.
          Type 'string' is not assignable to type 'HTMLDivElement'.ts(2322)
index.d.ts(134, 9): The expected type comes from property 'ref' which is declared here on type 'IntrinsicAttributes & Omit<HTMLAttributes<HTMLDivElement> & Partial<{}>, "className" | "ref"> & extraType & RefAttributes<...>'

Did i missed some thing?

Reproduction

No response

System Informations

@master/style-element.react: "^1.1.4
typescript: 4.5.5

@z22919456 z22919456 added the bug Something isn't working label Oct 20, 2022
@BenSeage
Copy link
Contributor

BenSeage commented Oct 20, 2022

@z22919456 Just replace HTMLDivElement with 'div', and it works.

@1aron 1aron closed this as completed Oct 23, 2022
@z22919456
Copy link
Author

z22919456 commented Oct 24, 2022

@BenSeage Got it! Thank for your help.

@BenSeage BenSeage transferred this issue from master-co/styled Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants