-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: infer EventEmitter extensions from API #259
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool change, just one type comment
'messagechannelmain', | ||
]; | ||
return !nonEventEmitters.includes(module.name.toLowerCase()); | ||
export const isEmitter = (doc: ParsedDocumentationResult[0]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we make this type cleaner by giving ParsedDocumentationResult[0]
a type and making type ParsedDocumentationResult = MyNewType[]
? Personally find that working backward from index access types makes this harder to grok at first glance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do that, but ParsedDocumentationResult
comes from @electron/docs-parser
not this module. So here we are.
🎉 This PR is included in version 8.15.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
if (module.name.toLowerCase() === 'session' && isStaticVersion) { | ||
console.log({ isStaticVersion, instanceModuleForStaticVersion, extendsInfo }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarshallOfSound, was this debug code that got left in accidentally? Seeing the output on e/e
now.
Instead of hard-coding a list of modules, we now infer if a module/class is an eventemitter with the following heuristic:
on
,once
andremoveListener
it's an emitter (e.g.ipcMain
)This correctly identifies several exposed interfaces as not being emitters and improves the type safety of newly added modules