How to resolve ' error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.'?

前端 未结 1 771
遥遥无期
遥遥无期 2021-02-18 23:51

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 \'         


        
1条回答
  •  感情败类
    2021-02-19 00:15

    Try by removing * as. You are exporting Auth as default. Default export property we import directly without any * or {}.

    import Auth from '../Auth/Auth';
    ..
    const auth = new Auth();
    

    0 讨论(0)
提交回复
热议问题