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
414 stars 41 forks source link

Fix client allowing extraneous properties upon creation #367

Closed jpwilliams closed 3 months ago

jpwilliams commented 11 months ago

Summary

Incorrect properties would be ignored and produce no type errors when creating a client via new Inngest(). For example, the following would show no errors, even though baseURL should be baseUrl:

new Inngest({
  id: "local-dev",
  name: "Local Dev",
  schemas: new EventSchemas().fromUnion<EventUnion>(),

  // Wrong but not error
  baseURL: "http://localhost:9999",
});

This PR ensures we're looking for the exact object instead.

Currently, we also ensure we allow excess properties if the options passed are a variable instead of an object literal, as this may indicate that the user wants to do more with the object.

Checklist

changeset-bot[bot] commented 11 months ago

⚠️ No Changeset found

Latest commit: 8f3c48b8519a58d8a6debc70c9bfee7903b13a0d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

jpwilliams commented 3 months ago

Addressed at runtime instead.