Open rudyxu1102 opened 1 year ago
3.2.47
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgEwKYDNgDtUGELgQ5bwC+c6UBcA5AG4CuqNAsAFDsDGRAzvALLAAHtgCCcALwoM2PAUjEYACgTs4cbACtUnGAC44AbRroIEGgF12pAJTsuvePnCTpmHM4WoSKtXBDC2DwGhoIiWKIWADR+nFCoAIYwqMhKNoh+6gD0WXCoQmA68DAAnoVwMBBwDFgA1lgQAO5YmXDcWDwQADaoAHRdEADmSjAAFsA8vaYQdmzqpNY2QA
As you can see, there is a ts error in the minimal reproduction above.
import { defineComponent } from 'vue' const MixinA = defineComponent({ inject: ['foo'] }) const Comp = defineComponent({ mixins: [MixinA], created() { // expect type to unknown console.log(this.foo) } })
foo should be inferred to unknown.
foo
unknown
ts error: Property 'foo' does not exist on type 'CreateComponentPublicInstance<{}, {}, {}, {}, {}, DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<...>, {}>, ... 12 more ..., {}>'
No response
Related to https://github.com/vuejs/vue/issues/12931
Vue version
3.2.47
Link to minimal reproduction
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgEwKYDNgDtUGELgQ5bwC+c6UBcA5AG4CuqNAsAFDsDGRAzvALLAAHtgCCcALwoM2PAUjEYACgTs4cbACtUnGAC44AbRroIEGgF12pAJTsuvePnCTpmHM4WoSKtXBDC2DwGhoIiWKIWADR+nFCoAIYwqMhKNoh+6gD0WXCoQmA68DAAnoVwMBBwDFgA1lgQAO5YmXDcWDwQADaoAHRdEADmSjAAFsA8vaYQdmzqpNY2QA
Steps to reproduce
As you can see, there is a ts error in the minimal reproduction above.
What is expected?
foo
should be inferred tounknown
.What is actually happening?
ts error: Property 'foo' does not exist on type 'CreateComponentPublicInstance<{}, {}, {}, {}, {}, DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<...>, {}>, ... 12 more ..., {}>'
System Info
No response
Any additional comments?
No response