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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cohlar opened this issue Apr 24, 2023 · 1 comment

Comments

@cohlar
Copy link

cohlar commented Apr 24, 2023

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.

@yyx990803
Copy link
Member

FYI the fix proposed here doesn't pass the dts tests in core.

@yyx990803 yyx990803 changed the title Experimental RFC 436 - cannot use generic prop as object key in template without props SFC generics - cannot use generic prop as object key in template without props May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants