infinitered / gluegun

A delightful toolkit for building TypeScript-powered command-line apps.
MIT License
2.95k stars 147 forks source link

Typescript warnings because of `NodeJS.EventEmitter` #740

Closed mikenikles closed 11 months ago

mikenikles commented 2 years ago

I recently upgraded @types/node to 16.11.11 and started to notice the following two errors.

Expand to see logs
gitpod /workspace/webstone/packages/cli $ pnpm prepublishOnly

> @webstone/cli@0.7.0 prepublishOnly /workspace/webstone/packages/cli
> pnpm build

> @webstone/cli@0.7.0 build /workspace/webstone/packages/cli
> pnpm clean && pnpm compile && pnpm copy-templates

> @webstone/cli@0.7.0 clean /workspace/webstone/packages/cli
> rm -rf ./dist

> @webstone/cli@0.7.0 compile /workspace/webstone/packages/cli
> tsc -p .

../../node_modules/.pnpm/gluegun@4.7.0/node_modules/gluegun/build/types/toolbox/prompt-enquirer-types.d.ts:70:34 - error TS2689: Cannot extend an interface 'NodeJS.EventEmitter'. Did you mean 'implements'?

70 declare class BasePrompt extends NodeJS.EventEmitter {
                                    ~~~~~~

../../node_modules/.pnpm/gluegun@4.7.0/node_modules/gluegun/build/types/toolbox/prompt-enquirer-types.d.ts:75:44 - error TS2689: Cannot extend an interface 'NodeJS.EventEmitter'. Did you mean 'implements'?

75 declare class Enquirer extends NodeJS.EventEmitter {
  

A fix that works in my environment, but I'd need a maintainer's input on this, is to remove extends NodeJS.EventEmitter from here and here.

FWIW, I found the Commander folks ended up with the same fix for their project.

jamonholmgren commented 2 years ago

@mikenikles Do you know if we can just remove the extends NodeJS.EventEmitter or do we also need to add the on() method signature like the Commander folks did?

shadowspawn commented 1 year ago

Commander only added the on() method signature because it is part of the documented Commander API. .on() may be used in client code. (And no other inherited EventEmitter methods are expected in client code.)

infinitered-circleci commented 11 months ago

:tada: This issue has been resolved in version 5.1.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket: