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

Add `GetStepTools<typeof inngest>` type for getting generic tooling type #329

Closed jpwilliams closed 1 year ago

jpwilliams commented 1 year ago

Summary

Adds a GetStepTools helper type to go alongside GetEvents to provide users with a way of accessing some of the internal types provided by Inngest.

type StepTools = GetStepTools<typeof inngest>;
type StepToolsWithTrigger = GetStepTools<typeof inngest, "app/user.created">;

Also provides GetFunctionInput to get all input arguments for an Inngest function.

type FunctionInput = GetFunctionInput<typeof inngest>;
type FunctionInputWithTrigger = GetFunctionInput<typeof inngest, "app/user.created">;

These complement the existing GetEvents type available.

type Events = GetEvents<typeof inngest>;

Both types include middleware in the result.

Checklist

Related

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: cef766182ba36933deb813ebdf506da5f145c118

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

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

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

inngest-release-bot commented 1 year ago

A user has added the prerelease/inngest label, so this PR will be published to npm with the tag pr-329. It will be updated with the latest changes as you push commits to this PR.

You can install this prerelease version with:

npm install inngest@pr-329

The last release was built and published from cef766182ba36933deb813ebdf506da5f145c118.