Skip to content

defineProps options object loses properties when using generics #9546

Open
@pikax

Description

@pikax

Vue version

3.3.7 & 3.4.alpha

Link to minimal reproduction

https://play.vuejs.org/#eNqNUk1v2zAM/SuELt2Axj70MMBIi25DD9thLbYcdXFsxlVmUxolpxkC//fS8kfT9AO9UXyP5OOjDuqrc8muRZWppS/YuAAeQ+ugzqm61Cp4raBCQjaFPFdaXWkyjbMc4AB3bN3qv0PoYMO2gTPpdKapsOQDOAE9XEKJG0PYU/2ngyaAPIPb9RaLALmfWyxXV+eaenidQaQBBMm/we0J3VhQfKRAuD2D8V9rGMsMArcYk52m7nPfKQpO8ilYT0GhaZkO5shcda6G/RdN7pKttyTexfl6BMSyWZFWYkn/1uo+BOezNC1KkrISa7PjhDCk5Jr0WmgptxRMg4vSNtcXyUXyJS2ND8fpBH2zWLN98MjSRKtxrTgmleQOecFIJTLyR8eelB2PPoFejJ/8E1OCl7NvTHViSWEbZ2rkWxeMfItn1uR1bR9+xtx8jVhzj8XfV/Jbvx92umOMyo72DzlXGAb45s8v3Es8g40t23o8wxvgb/S2bnuNA+1bS6XIPuJFtT/ihQ1VK3+zD0h+WqoXOn3K8R7f31n9Sa64PbvYPQLEQTNC

Steps to reproduce

image
<script setup lang="ts" generic="T">
import { PropType } from 'vue'
const props = defineProps({
  a: Object as PropType<T>,

  b: {
    type: Object as PropType<T>
  },

  c: {
    type: Object as PropType<T>,
    required: true,
  }
})

props.a
props.b
props.c
</script>

What is expected?

The props to be declared correctly

What is actually happening?

Properties are been excluded from props, unless they are required 🤔

System Info

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions