refactor(react-centra-checkout): make handler properties required - #794
refactor(react-centra-checkout): make handler properties required#794adamsoderstrom wants to merge 1 commit into
Conversation
Since we already perform assertions on the existence of the context values from the `useCentraHandlers` and `useCentraSelection`, optional properties doesn't resemble the runtime values.
🦋 Changeset detectedLatest commit: 62b2489 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR updates @noaignite/react-centra-checkout’s handler typing so ContextMethods handler properties are required (matching the provider’s runtime guarantees), and aligns internal typings/tests accordingly.
Changes:
- Make all
ContextMethodshandler properties required (remove?optionality). - Simplify
useCallbacktypings to useContextMethods['...']directly (noNonNullable). - Update handler invocation in tests and add a changeset entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/react-centra-checkout/src/Context.tsx | Makes ContextMethods handlers required and updates internal callback typings to match. |
| packages/react-centra-checkout/src/Context.test.tsx | Removes optional chaining when invoking handlers, reflecting required handler presence. |
| .changeset/required-checkout-handlers.md | Adds release note for the typing change (version bump classification needs adjustment). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| --- | ||
| '@noaignite/react-centra-checkout': patch | ||
| --- |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #794 +/- ##
=======================================
Coverage 70.42% 70.42%
=======================================
Files 66 66
Lines 1055 1055
Branches 265 265
=======================================
Hits 743 743
Misses 248 248
Partials 64 64
🚀 New features to boost your workflow:
|
Since we already perform assertions on the existence of the context
values from the
useCentraHandlersanduseCentraSelection,optional properties doesn't resemble the runtime values.