Здравствуйте, была ошибка насчет типов в TS:
property '$error' does not exist on type 'CombinedVueInstance<Vue, { email: string; password: string; }, { onSubmit(): void; }, unknown, Readonly<Record
, вроде больше не ругается, но почему-то не может найти модуль, хотя ошибка насчет типов пропала. И буду очень благодарен если подкинете какие-нибудь статьи, гайды и т.п. насчет использования ts вместе с vue, где все подробно насчет всего написано ( документации не хватает ).
Ошибка:
Failed to compile.
./src/main.ts
Module not found: Error: Can't resolve './token-service' in 'D:\__my_prog\vue\crm\src'
token-service.d.ts:
import Vue from 'vue'
import TokenService from '../path/to/token-service'
declare module 'vue/types/vue' {
interface Vue {
$message(html: string) : any
$error(html: string) : any
}
}
message.plugin.ts:
import M from 'materialize-css'
export default {
install(Vue, options) {
Vue.prototype.$message = function (html: string): any {
M.toast({html})
}
Vue.prototype.$error = function(html: string): any {
M.toast({html: `[Ошибка]: ${html}`})
}
}
}
main.ts:
import Vue from "vue";
import Vuelidate from 'vuelidate'
import App from "./App.vue";
import "./registerServiceWorker";
import router from "./router";
import store from "./store";
import dateFilter from "./filters/date.filter";
import messagePlugin from "./utils/message.plugin"
import './token-service'
Vue.config.productionTip = false;
Vue.use(messagePlugin)
Vue.use(Vuelidate as any)
Vue.filter('date', dateFilter)
new Vue({
router,
store,
render: h => h(App)
}).$mount("#app");