Skip to content

[2.7.x] Here is a type error when using ref() on attribute 'ref' in TSX #12758

Closed
@shiluo34

Description

@shiluo34

Version

2.7.10

Reproduction link

codesandbox.io

Steps to reproduce

Using type 'Ref' on ref will notice the error : jsx.d.ts(1305, 3): The expected type comes from property 'ref' which is declared here on type 'ElementAttrs<HTMLAttributes>'.

image

In the vue/types/jsx.d.ts, the type ReservedProps only support type'String' in Vue2.7.x,but supporting type 'String'/'Ref'/'Function' in Vue3.x

  • Vue3 - jsx.d.ts
    image

  • Vue2.7.x -jsx.d.ts
    image

What is expected?

Using type 'Ref' on the property 'ref'.

What is actually happening?

The type 'ref' only support 'String | undefined'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions