inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
440 stars 43 forks source link

Fix `GetEvents<>` helper returning internal events by default #480

Closed jpwilliams closed 9 months ago

jpwilliams commented 9 months ago

Summary

As seen in #452, the GetEvents<> type helper returns user-defined and internal functions such as inngest/function.finished. This was an unintentional change to the helper when adding internal events to the typing in #426.

The most common use for this helper is to create shims over inngest.send(). The inclusion of the internal events in this helper type means that the type cannot be passed to inngest.send() without wrapping it with WithoutInternal<>.

In this PR, we change GetEvents<> to now only return the user's events by default. If a user wishes to access internal events too, they can pass an extra generic parameter to do so:

type OnlyUserEvents = GetEvents<typeof inngest>; // compatible with `inngest.send()`
type AllEvents = GetEvents<typeof inngest, true>; // not compatible with `inngest.send()`

Checklist

Related

changeset-bot[bot] commented 9 months ago

🦋 Changeset detected

Latest commit: 44ba011a561368e0dccf01863153f499da61cc67

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------- | ----- | | inngest | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR