nativescript-vue-navigator icon indicating copy to clipboard operation
nativescript-vue-navigator copied to clipboard

Could not find a declaration file for module 'nativescript-vue-navigator'

Open hgc2002 opened this issue 5 years ago • 2 comments
trafficstars

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 containingdeclare 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.

hgc2002 avatar Dec 25 '19 09:12 hgc2002

In declarations: declare module 'nativescript-vue-navigator'

In component: $navigator: any;

PixsaOJ avatar Jul 02 '23 12:07 PixsaOJ

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;
  }
}

dcamargon avatar Dec 14 '23 13:12 dcamargon