igorkamyshev/withease

TriggerProtocol is not compatible between this package and @farfetched/core

lenstr opened this issue · 2 comments

lenstr commented

Hey!

I encountered a compilation error with the following example:

keepFresh(config.listQuery, {
    triggers: [
        trackNetworkStatus,
    ],
})

The error message is as follows:

 Type 'NetworkStatus & TriggerProtocol' is not assignable to type 'TriggerProtocol'.
   The types of ''@@trigger'().setup' are incompatible between these types.
     Type 'Event<void>' is missing the following properties from type 'EventCallable<void>': prepend, targetable

It appears that TriggerProtocol is defined differently in @farfetched/core and @withease/web-api.

Here's a comparison of the definitions:

In @withease/web-api

type TriggerProtocol = {
    '@@trigger': () => {
        setup: Event<void>;
        teardown: Event<void>;
        fired: Event<unknown> | Event<void>;
    };
};

In @farfetched/core

type TriggerProtocol = {
    '@@trigger': () => {
        setup: EventCallable<void>;
        teardown: EventCallable<void>;
        fired: Event<unknown> | Event<void>;
    };
};

Thanks a bunch for the awesome libraries – they're really helpful! Whenever you've got a moment, I'd appreciate any guidance on this issue. Keep rocking with the great work!

Hello! Yep, my bad 😞 sorry, will be fixed asap

Fixes in 3e21bda and will be released as @withease/web-api@1.1.1