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

Typscript declaration file for module missing #19

Open
blugri opened this issue Jan 8, 2020 · 2 comments
Open

Typscript declaration file for module missing #19

blugri opened this issue Jan 8, 2020 · 2 comments

Comments

@blugri
Copy link

blugri commented Jan 8, 2020

Vue.js run error:

Could not find a declaration file for module 'vue-msal'.
Try npm install @types/vue-msal if it exists or add a new declaration (.d.ts) file containing declare module 'vue-msal';

when running the npm command the following error is displayed.

npm install @types/vue-msal
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fvue-msal - Not found
npm ERR! 404
npm ERR! 404 '@types/vue-msal@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

@ddlaat
Copy link

ddlaat commented Apr 15, 2020

Just add a file to your root with for example the name vue-msal.d.ts and add the following line:

declare module 'vue-msal';

@grobgl
Copy link

grobgl commented Jun 24, 2020

For reference, this is what I had to do:

// types/vue-msal/index.d.ts

declare module 'vue-msal' {
  import _Vue from 'vue';
  import { DataObject, Options } from 'vue-msal/lib/src/types';

  export class msalMixin extends Vue {
    readonly msal: DataObject
  }

  export default function MsalPlugin<Options>(Vue: typeof _Vue, options: Options): void
}
// types/vue/index.ts

import VueRouter, { Route } from 'vue-router';
import { MSALBasic } from 'vue-msal/lib/src/types';

declare module 'vue/types/vue' {
  interface Vue {
    $router: VueRouter
    $route: Route
    $msal: MSALBasic
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants