Open hgc2002 opened 4 years ago
In declarations:
declare module 'nativescript-vue-navigator'
In component:
$navigator: any;
In case this help anyone, here is what worked for me
I wonder how Vuex
was able to have the store
property configured, so found the following code here https://github.com/vuejs/vuex/blob/v3.6.2/types/vue.d.ts
In the types
folder, I created a modules.d.ts
file with the following content
import Vue, { ComponentOptions } from "vue";
declare module "nativescript-vue-navigator";
declare module "vue/types/options" {
interface ComponentOptions<V extends Vue> {
navigator?: any;
}
}
declare module "vue/types/vue" {
interface Vue {
$navigator: any;
}
}
I just install nativescript-vue-navigator to test it with 3 very basic pages (just labels and buttons on them) and this happened (also it crashed on ios).
Then I saw this message in the editor (vscode):
Could not find a declaration file for module 'nativescript-vue-navigator'. '/Users/hgc/aaa/proyectos/polimanual-nsvue/node_modules/nativescript-vue-navigator/index.js' implicitly has an 'any' type. Try
npm install @types/nativescript-vue-navigatorif it exists or add a new declaration (.d.ts) file containing
declare module 'nativescript-vue-navigator';ts(7016)
Apparently my project believes it has TypeScript somewhere, that is little strange because I simply download it from NSPlayground (yes, the web!, and starting the tutorial from scratch with HelloWorld!).
I was playing with other projects before to learn TypeScript but I don't know how all got messed to this point.