You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a component with defineComponent that has a prop with a default function e.g.
exportdefaultdefineComponent({data(){return{dataOne: "Hello World From Data"}},props: {propOne: String,propTwo: {type: String,default(){// <-- this causes invalid prop types in the templatereturn'';}}}});
What is expected?
Correct prop types in the template
What is actually happening?
Invalid prop types, looks like it's showing array values as prop types
constComp=defineComponent({// data() {// this.$props.propTwo// return {// dataOne1: 'Hello World From Data',// }// },props: {propOne: String,propTwo: {default(){return'foo'},},},})newComp().$props.propOne
Or when my data function is written after props, it will also work.
constComp=defineComponent({props: {propOne: String,propTwo: {default(){return'foo'}}},data(){this.$props.propTworeturn{dataOne1: 'Hello World From Data'}}})newComp().$props.propOne
Vue version
3.4.27
Link to minimal reproduction
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgEwKYDNgDtUGELgQ5bwC+c6UBcA5AG4CuqNA3AFBsDGRAzvPuDgBeFBmx4CkYjAAUCNnEUoAhjGUyAlIgVLdUVDAZQs23WaXJVygPI4AXHABEACVQAbNxDgB1aG+RwAGJUIHAAIlaOOuak0XCkADRxYFRgPA7y5oopEGC2qA4AyjBQ2ADmSVlwOWAAKgDuEBlxVTAAnmAFcMWlWBUtWWjoygxuslqZVVn6hsa0rAMxi-FxiWykGuxsAPTbcAACMDwAtKgAHp2cMKdQVFBsMjj1cAJgmhoAdAAkNTwfbqg+jAABZbbhYPgvSS+KAAa3KwlEmBwryIgNkk0UljUmlM0wMRhMmKm2Js9icrg8Xhh-iCIXCkWWsV0a10v2aVRq+SKJXKlSyNQaTTxUzg7U6PN6-VFil2cAAchAYF0sF4hiMxhQGFgrsAiEzVutNhw5YcTudLtdULdoA8nlDwDD4X13t9fv9AWUQSwgA
Steps to reproduce
Create a component with
defineComponent
that has a prop with a default function e.g.What is expected?
Correct prop types in the template
What is actually happening?
Invalid prop types, looks like it's showing array values as prop types
System Info
No response
Any additional comments?
Originally posted in volar repo, but requested to post here instead: vuejs/language-tools#3323
The text was updated successfully, but these errors were encountered: