Skip to content

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

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

Closed
cohlar opened this issue Apr 24, 2023 · 2 comments
Closed

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
@edison1105
Copy link
Member

edison1105 commented Feb 24, 2025

The issue can no longer be reproduced using the latest version of Vue

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants