Angular 2 + Auth0 (Could not find a declaration file for module 'auth0-js'. )

心不动则不痛 提交于 2019-12-10 23:19:53

问题


Could not find a declaration file for module 'auth0-js'. 'C:/sandbox/loginauth0/node_modules/auth0-js/src/index.js' implicitly has an 'any' type.

I wanted to use the auth0 login. But after following the instructions and building my own Angular 2 service.

import * as auth0 from 'auth0-js';

gives an error like above. but I put it in with "npm install --save auth0-js" and its in my node_modules


回答1:


First, be sure you turn off the property noImplicitAny in tsconfig.json.

Then, verify you are following the steps here: https://auth0.com/docs/quickstart/spa/angular2




回答2:


Auth0.js doesn't yet provide TypeScript type definition file. You can try using:

const auth0 = require('auth0-js');

or the more brute-force method of turning the noImplicitAny flag to false in your tsconfig.json file, but that turns off warnings/errors for the whole project. See more info here.



来源:https://stackoverflow.com/questions/44911538/angular-2-auth0-could-not-find-a-declaration-file-for-module-auth0-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!