Skip to content

Commit

Permalink
Fix a TS error when using Inngest in projects with composite setting (
Browse files Browse the repository at this point in the history
#460)

## Summary
<!-- Succinctly describe your change, providing context, what you've
changed, and why. -->
This PR Adds some type exports to `index.ts` that fix a TS error in
composite projects.

After changes to the `types.ts` the issue #384 appeared again. This PR
is similar to #385 - it fixes the TS error by adding necessary exports
to the `index.ts`

## Checklist


- [ ] ~~Added a [docs PR](https://github.com/inngest/website) that
references this PR~~ N/A no docs needed
- [ ] ~~Added unit/integration tests~~ N/A not testable
- [x] Added changesets if applicable

## Related
- #385 
- #384

---------

Co-authored-by: Jack Williams <1736957+jpwilliams@users.noreply.github.com>
  • Loading branch information
MonsterDeveloper and jpwilliams committed Jan 12, 2024
1 parent f88d474 commit a225206
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tall-hornets-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"inngest": patch
---

Add exports for `FinishedEventPayload` and `Context` types to fix a TypeScript error when using Inngest in projects with `composite` setting in `tsconfig`.
25 changes: 22 additions & 3 deletions packages/inngest/etc/inngest.api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/inngest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ export { ProxyLogger } from "./middleware/logger";
export type { LogArg } from "./middleware/logger";
export type {
ClientOptions,
Context,
EventNameFromTrigger,
EventPayload,
FailureEventArgs,
FailureEventPayload,
FinishedEventPayload,
FunctionOptions,
FunctionTrigger,
Handler,
Expand Down
8 changes: 8 additions & 0 deletions packages/inngest/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ export type FailureEventArgs<P extends EventPayload = EventPayload> = {
error: Error;
};

/**
* The payload for an internal Inngest event that is sent when a function
* finishes, either by completing successfully or failing.
*
* @public
*/
export type FinishedEventPayload = {
name: `${internalEvents.FunctionFinished}`;
data: {
Expand Down Expand Up @@ -278,6 +284,8 @@ export type BaseContext<
/**
* Builds a context object for an Inngest handler, optionally overriding some
* keys.
*
* @internal
*/
export type Context<
TOpts extends ClientOptions,
Expand Down

0 comments on commit a225206

Please sign in to comment.