curveball / core

The Curveball framework is a TypeScript framework for node.js with support for modern HTTP features.
https://curveballjs.org/
MIT License
526 stars 7 forks source link

Type 'typeof EventEmitter' is not a constructor function type. #138

Closed teddybee closed 4 years ago

teddybee commented 4 years ago

I have started a project with typescript. The tsc returns this error at compile:

node_modules/@curveball/core/dist/application.d.ts:26:42 - error TS2507: Type 'typeof EventEmitter' is not a constructor function type.

After little searching I found a solution. Could you fix this please? https://stackoverflow.com/questions/33572425/type-x-is-not-a-constructor-function-type-ts2507 I am using "typescript": "^3.8.3", "@curveball/core": "^0.11.1".

Dev run is working without that error by "ts-node-dev": "^1.0.0-pre.44".

evert commented 4 years ago

Hi!

Are you using an unstable version of @types/node? I think this is a problem with the 13.* series. Not sure if this something that will be fixed, but switching to a version of that package that matches your node version is regardless a good idea.

evert commented 4 years ago

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/41353

teddybee commented 4 years ago

Yes, "@types/node": "^13.9.0", Thank you for the advice, I have just added it wthout versioning...

This solved my problem: "@types/node": "^12.12.29".

evert commented 4 years ago

I also committed a fix to help with this. You're not the first to run into this and there is a workaround. Going to release it shortly.