Hi, I am developing a small browser editor for my application. This editor can have tools. These tools are really just event-emitters and event consumers. There are many tools that I forsee sharing some behavior so I thought a mix-in pattern would be appropriate for this. I am mostly refferring to the mix-in pattern in the Typescript documentation here.
My tools emit events, specified by a a generic type when creating them. Mixins may say "this tool can emit these events." I am having trouble getting my mixin to extend this generic. Here is a my module currently. I have commented where I am getting type-errors.
See attached, it got too long
If somebody has a different pattern that I could follow to also get this job done, let me know. For reference, I am using React. I have an editor context with the current tool and many components may reference this tool (like for drawing, display tool tips, forwarding events, etc).
Using the mixin pattern with TypeScript