Subscribe on changes!

Manually annotating prop with JSDoc doesn't produce right type

avatar
Oct 11th 2022

Vue version

3.2.0

Link to minimal reproduction

https://sfc.vuejs.org/#eNpNUMtuwjAQ/JWVL4Eo2Gp7i9yoHHvrHXMIZGmDsGPZDgVZ/veuE5Tii/cxOzO7kW2t5dcRWc1kQG0vbcBGGQDZ9dcmRuip6iElKXJBGSmeYJT6o+ttoBhvdnABOjy14yVAzCSm1VhD8Wk6vBVVrlg3WF/PXQBRlvAR7hYh9jqPrwryUqz5F8GkGfUB3W5fwe6lgtcK3vZNglLMs5OxhQkg09Swda69T0r5PczUsFrDe/NPM/dT/hKBKZBiWYRVbDaz0a3lZz8YOs4kox4Nr9girBg5zrliPyHQbkL40zGf9Oz54L4FRdyNJvQaOXq9Objh16MjYsUmA6TP0h/G+3+V

Steps to reproduce

  1. Download the code from the reproduction playground
  2. Install Volar in the editor
  3. Hover over the items in the template

What is expected?

The type of items should be number[]

What is actually happening?

The type of items is any.

Screenshot 2022-10-11 at 23 25 08

System Info

No response

Any additional comments?

I've also created example projects using both Vue 3 and Vue 2.7 at:

(note that those repros are on their own branches)

This is to show that this works in Vue 2.7 when annotating using the PropOptions type (Vue 2 variant of Vue 3's Prop type).

Also see corresponding Volar issue: https://github.com/johnsoncodehk/volar/issues/1984#issuecomment-1275161205

avatar
Oct 12th 2023

I've started a related discussion about JSDoc and defineProps() macro: https://github.com/vuejs/rfcs/discussions/584