Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hgc2002 opened this issue Dec 25, 2019 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@hgc2002
Copy link

hgc2002 commented Dec 25, 2019

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.

@rigor789 rigor789 added the enhancement New feature or request label Mar 27, 2020
@PixsaOJ
Copy link

PixsaOJ commented Jul 2, 2023

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

In component:
$navigator: any;

@dcamargon
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

4 participants