Closed as not planned
Description
Vue version
v3.2.20
Link to minimal reproduction
Steps to reproduce
Using <script setup lang="ts>
, the defineProps<PropsType>
function does not infer correct props attributes from the Typescript type. It always generate props being null
.
- Create a Typescript type for some props. For instance:
interface PropsType {
foo: string;
bar?: number;
}
- Use this type in the
defineProps
generic type:defineProps<PropsType>()
- Take a look at the props object in the transpiled code
What is expected?
The transpiled props object should be
props: {
foo: { type: String, required: true },
bar: Number
},
What is actually happening?
This is what is generated since v3.2.20 (it's working fine before that version)
props: {
foo: null,
bar: null
},
System Info
N/A
Any additional comments?
You can switch between versions on the playground to see it's a regression from version v3.2.20.
Metadata
Metadata
Assignees
Labels
No labels