Issue
i recently converted my vuejs to typescript base, but now i have problem with using mixin in typescript. i used two types of mixin, but none worked for me and it shows error ts2339, and i couldnt found the solution on https://v2.vuejs.org/v2/guide/typescript.html#Basic-Usage: first one:
//mixin.ts
import {ViewState} from "@/types";
import {mocked_view_state} from "@/api/mock/profile.device.group.mock";
export const ProfileDeviceGroup = {
methods: {
resetViewState(): ViewState {
return mocked_view_state;
}
}
};
second one:
//mixin.ts
import Vue from "vue";
import {ViewState} from "@/types";
import {mocked_view_state} from "@/api/mock/profile.device.group.mock";
const ProfileDeviceGroup = Vue.extend({
methods: {
resetViewState(): ViewState {
return mocked_view_state;
},
}
});
export default ProfileDeviceGroup;
so, is there any way to fix this problem?
..............
Update:
..............
after using vue-typed-mixins, the problem has been solved, but another problem exposes as you can see in below picture:
Solution
based on this issue https://github.com/ktsn/vue-typed-mixins/issues/4 which i created in vue-typed-mixins's github, it is a not-fixed issue which the author believes webstorm and Vuetr plugin should fix, and its not related to vue-typed-mixins. however i think the problem still is related to vue-typed-mixins plugin, but i hope the problem will be fixed soon and should thank the author of vue-typed-mixins team, and webstorm team and Vuetr.
for those who (like myself) want to keep going with vue+typescript, there seems to be a better way to pass these problems, which is vue2-composition-api, which some teams has been using and told me it was ok with typescript and has no problem since there is no need to use mixin anymore. is vuejs2.x composition api fully compatibile with typescript?
i hope it work...
Answered By - SeyyedKhandon
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.