gluegun icon indicating copy to clipboard operation
gluegun copied to clipboard

Typescript warnings because of `NodeJS.EventEmitter`

Open mikenikles opened this issue 3 years ago • 1 comments

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/[email protected] prepublishOnly /workspace/webstone/packages/cli pnpm build

@webstone/[email protected] build /workspace/webstone/packages/cli pnpm clean && pnpm compile && pnpm copy-templates

@webstone/[email protected] clean /workspace/webstone/packages/cli rm -rf ./dist

@webstone/[email protected] compile /workspace/webstone/packages/cli tsc -p .

../../node_modules/.pnpm/[email protected]/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/[email protected]/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<T = object> 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.

mikenikles avatar Dec 05 '21 01:12 mikenikles

@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?

jamonholmgren avatar Dec 08 '21 19:12 jamonholmgren

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.)

shadowspawn avatar Dec 06 '22 19:12 shadowspawn

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

The release is available on:

Your semantic-release bot :package::rocket:

infinitered-circleci avatar Sep 28 '23 17:09 infinitered-circleci