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 path matching types getting lost in recursive types #354

Closed jpwilliams closed 1 year ago

jpwilliams commented 1 year ago

Summary

Fixes a "Type instantiation is excessively deep and possibly infinite" bug when attempting to generate paths for events with recursive types, such as a common JsonValue type.

type JsonObject = { [Key in string]?: JsonValue };
type JsonArray = Array<JsonValue>;
type JsonValue =
  | string
  | number
  | boolean
  | JsonObject
  | JsonArray
  | null;

We refactor the way paths are generated a little here, most notably ensuring we skip known deep/recursive types and don't needlessly iterate those we've seen before.

Checklist

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: 3e516eef3c67faac1421d55912378f7027aadded

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

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-354. 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-354

The last release was built and published from 3e516eef3c67faac1421d55912378f7027aadded.