Closed
Description
Version
2.7.3
Reproduction link
Or just create this file in minimal vue-ts (v2) project
import {defineComponent} from "vue";
// Replace vue import with this, and it woks fine.
//import {defineComponent} from "@vue/composition-api";
import App from "./App.vue";
export default defineComponent({
components: {
App,
},
data() {
return {};
},
provide(): any {
return {
fetchData: this.fetchData,
};
},
created() {
this.fetchData();
},
methods: {
fetchData() {
throw new Error("Not implemented.");
},
},
});
Steps to reproduce
Clone example repo, run pnpm install
, run pnpm vue-tsc --noEmit
What is expected?
No errors.
What is actually happening?
Has ts errors.
src/broken-method-type.ts:15:23 - error TS2339: Property 'fetchData' does not exist on type 'CreateComponentPublicInstance<{}, unknown, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, {}, {}, false, OptionTypesType<{}, {}, {}, {}, {}, {}>, ... 5 more ..., {}>'.
15 fetchData: this.fetchData,
~~~~~~~~~
src/broken-method-type.ts:19:10 - error TS2339: Property 'fetchData' does not exist on type 'CreateComponentPublicInstance<{}, unknown, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, {}, {}, false, OptionTypesType<{}, {}, {}, {}, {}, {}>, ... 5 more ..., {}>'.
19 this.fetchData();
~~~~~~~~~
Found 2 errors in the same file, starting at: src/broken-method-type.ts:15
I'm updating our app from vue-2.6 + @vue/composition-api
to vue-2.7
, and after update i see many type checking erros.
If you replace import from "vue" to import from "@vue/composition-api", it works fine.
If you remove data
or components
, it works fine.
Metadata
Assignees
Labels
No labels