-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(TS): replace 'any' with types for event data (listener parameter) #3027
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
base: master
Are you sure you want to change the base?
Conversation
Hi @metalwarrior665, is this a draft because it's still a work in progress or are you already asking for feedback? |
export abstract class EventManager { | ||
protected events = new AsyncEventEmitter(); | ||
export abstract class EventManager<SystemInfo> { | ||
protected events = new AsyncEventEmitter<EventTypeToArgs<SystemInfo>>(); |
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.
One of these days we ought to move to having the class as the EventEmitter, but not today :D
import { EventManager, EventType } from './event_manager'; | ||
|
||
export class LocalEventManager extends EventManager { | ||
interface LocalSystemInfo { |
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.
interface LocalSystemInfo { | |
export interface LocalSystemInfo { |
…etails in EventManager
@janbuchar I'm asking for feedback. I kept it as Draft mainly to make sure we resolve the breaking change part first. Can make it Ready for review. |
When working on apify/apify-sdk-js#404, I realized all event data are
any
, this is an attempt to correct that. It is just a draft idea with many problems:PlatformEventManager
So take this more as a PoC idea. The reason I got to this is that I wanted to handle
Actor.on('persistState')
but do extra step if there isisMigrating
orisAborting
so not a huge use-case to have the types correct.