fix(verifier): accept lifecycle state handlers - #1876
Open
KSHITIZ6341 wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1876 +/- ##
=======================================
Coverage 61.06% 61.06%
=======================================
Files 67 67
Lines 4187 4187
Branches 352 352
=======================================
Hits 2557 2557
Misses 1628 1628
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
VerifierOptionscurrently intersectsProxyOptionswithPartial<MessageProviderOptions>. Both types declarestateHandlerswith different call signatures, so TypeScript requires every verifier state handler to satisfy both the HTTP and message-provider forms. That rejects the supported{ setup, teardown }lifecycle form.This removes the redundant
MessageProviderOptionsintersection becauseProxyOptionsalready carrieslogLevel,messageProviders, and the HTTP verifierstateHandlers. It also lets state handlers resolve without a value, matching their existing optional provider-state injection behaviour, and derives the internalsetupStatesreturn type fromStateFunc.The change is type-compatible and does not alter verifier runtime behaviour. Existing function handlers and handlers returning provider-state values remain supported.
Credit to @ghost91- for the minimal failing example, @valkolovos for tracing the conflict to the overlapping declarations, and @muratkeremozcan for supplying a standalone reproduction.
Fixes #1164
Verification
masterwithTS2418before the fix.biome format(228 files)biome lint(228 files)tsc --noEmitvitest run(28 files, 284 tests; coverage thresholds passed)rimraf dist,tsc, andcopyfiles package.json ./distgit diff --checkNo practical local test suite was omitted. The repository CI operating-system and Node.js version matrix remains to run.