Nevzat
Nevzat

Reputation: 31

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

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

Upvotes: 3

Views: 966

Answers (2)

Nollymar Longa
Nollymar Longa

Reputation: 139

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

Upvotes: 2

Nico Sabena
Nico Sabena

Reputation: 7054

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.

Upvotes: 1

Related Questions