Open
Description
Version
2.6.11
Steps to reproduce
Create component with optional prop being an object and try to access its property
import Vue, { PropType } from 'vue';
Vue.extend({
props: {
container: Object as PropType<{ n: number }>,
// or container: Number
},
mounted () {
// should fail because this.container could be undefined
console.log(this.container.n);
},
});
What is expected?
TS error: Object is possibly undefined
What is actually happening?
No error
Note
It works as expected with Composition API plugin