Skip to content

SFC generics - cannot use generic prop as object key in template without props #8144

Closed as not planned
@cohlar

Description

@cohlar

Vue version

3.2.45

Link to minimal reproduction

https://github.com/cohlar/vue-rfc436/tree/prop_object_key_error

Steps to reproduce

  1. Open in IDE with volar enabled or run vue-tsc (tested with versions 1.0.9 to 1.4.3)
  2. TheWelcome component should show TS errors

What is expected?

Props defined with defineProps should be available in the template without the need to use const props = defineProps<...>() and props. before the prop name.

What is actually happening?

We must use const props = defineProps<...>() in the script and props. before the prop name in the template to get no error.

System Info

No response

Any additional comments?

This issue was initially raised in the volar repo and @johnsoncodehk proposed a "naive" solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions