You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a starter and I hope you beg my pardon cuz maybe I'm looking a little stupid for you, but, I can't solve that problem.
I created a util called bus, and I am trying to use the Emitter with TS :
import Emitter from "tiny-emitter";
export default new Emitter();
but I received that error:
This expression is not constructable.
Type 'typeof import("C:/projeto Controle Financeiro/wa-controle-financeiro/node_modules/tiny-emitter/index")' has no construct signatures.
I hope you can help me.
The text was updated successfully, but these errors were encountered:
The error occurred because the class is exported as named export whereas you imported it as a default import. So instead of import Emitter from "tiny-emitter"; , you should import it as import { TinyEmitter } from "tiny-emitter"; according to the d.ts file.
Edit: The d.ts file from the npm registry is incomplete compared to the file on github. Hence the error. Otherwise import Emitter from "tiny-emitter"; should work!
I'm a starter and I hope you beg my pardon cuz maybe I'm looking a little stupid for you, but, I can't solve that problem.
I created a util called bus, and I am trying to use the Emitter with TS :
but I received that error:
I hope you can help me.
The text was updated successfully, but these errors were encountered: