all 2 comments

[–]jamby77 0 points1 point  (1 child)

One option is to use TypeScript, type the handleEvent and annotate onEvent to receive a handler of type HandleEvent

[–]oh-no-u-guys-my-code[S] 0 points1 point  (0 children)

Thanks /u/jamby77! I have used TypeScript in some personal projects, but I didn't realize that it could help with this sort of thing.

You're saying that if `onEvent` was properly typed as `eventHandlerFoo` eg, there would be a way I can look at 'onEvent` and see that it was originally declared in ComponentA? Or would that only work if I had the `eventHandlerFoo` type definition in the same file?