mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
test: add test for type casting $refs to defineComponent instance type
This commit is contained in:
parent
fffbb9e856
commit
9ed684785f
@ -1139,6 +1139,14 @@ defineComponent({
|
||||
}
|
||||
})
|
||||
|
||||
const X = defineComponent({
|
||||
methods: {
|
||||
foo() {
|
||||
return 123
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// Missing / mismatching Vue 2 properties
|
||||
// https://github.com/vuejs/vue/issues/12628#issuecomment-1177258223
|
||||
defineComponent({
|
||||
@ -1149,6 +1157,11 @@ defineComponent({
|
||||
this.$ssrContext
|
||||
this.$isServer
|
||||
this.$children[0].$root.$children
|
||||
|
||||
// type casting refs
|
||||
const foo = this.$refs.foo as InstanceType<typeof X>
|
||||
foo.foo().toExponential()
|
||||
|
||||
return h('div', {}, [...this.$slots.default!])
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user