rendajs / Renda

A modern rendering engine for the web.
https://rendajs.org
MIT License
10 stars 4 forks source link

refactor(TypedMessenger): Remove old type for responsehandlers #807

Closed jespertheend closed 1 year ago

jespertheend commented 1 year ago

Not really sure why this was here in the first place. I think the idea was to make autocompletions for setResponseHandlers() work or something. Either way, this doesn't seem necessary anymore now, and in fact was causing some issues while working on #800. Specifically, I was trying to pass an existing generic argument to the TypedMessenger, something like:

/**
 * @template {TypedMessengerSignatures} TRes
 * @template {TypedMessengerSignatures} TReq
 * @param {TRes}
 */
function createMessenger(responseHandlers) {
    /** @type {TypedMessenger<TRes, TReq> */
    const messenger = new TypedMessenger();
    messenger.setResponseHandlers(responseHandlers);
    //                            ^^^^^^^^^^^^^^^^
    //               'TRes' is not assignable to parameter of type 'ResponseHandlers'
}