119
rated 0 times
[
121]
[
2]
/ answers: 1 / hits: 40958
/ 7 Years ago, wed, october 4, 2017, 12:00:00
I am importing a .js file (so not a .ts-file) called Auth.js into my reactjs&typescript application, so in my component I have this:
import * as Auth from '../Auth/Auth';
..
const auth = new Auth();
This is part of my Auth.js:
export default class Auth {
auth0 = new auth0.WebAuth({
domain: AUTH_CONFIG.domain,
clientID: AUTH_CONFIG.clientId,
redirectUri: AUTH_CONFIG.callbackUrl,
audience: `https://${AUTH_CONFIG.domain}/userinfo`,
responseType: 'token id_token',
scope: 'openid'
});
constructor() {
this.login = this.login.bind(this);
this.logout = this.logout.bind(this);
this.handleAuthentication = this.handleAuthentication.bind(this);
this.isAuthenticated = this.isAuthenticated.bind(this);
}
..
When I run webpack I get the following error message:
ERROR in ./src/containers/main.tsx
(16,14): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
How can I resolve this TS-error?
More From » reactjs