test(browser): fix TS6 typecheck errors in ceremonies mediation test#87
Merged
Conversation
The "requests conditional mediation only when conditional=true" test declared its CredentialsContainer.get mocks with zero parameters (vi.fn(async () => ...)). Under TypeScript 6, mock.calls[0] is then typed as an empty tuple [], so indexing [0] failed (TS2493) and casting the resulting undefined element to CredentialRequestOptions failed (TS2352). Give both mocks the real get signature (_options?: CredentialRequestOptions) so the recorded call args are typed correctly. Test-only change; no production source touched. typecheck is now clean and all 101 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Contributor
Author
|
@bernata Can you review this PR? It's a fix for Also, should I add the typecheck run to the CI process? |
bernata
approved these changes
Jun 20, 2026
Contributor
I'm all for adding more strict type checking. |
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
Fixes the
tsc --noEmit(npm run typecheck) failures inclients/passkeys-browser/test/ceremonies.test.ts.The "requests conditional mediation only when conditional=true" test declared its
CredentialsContainer.getmocks with zero parameters (vi.fn(async () => ...)). Under TypeScript 6,mock.calls[0]is then typed as an empty tuple[], so:mock.calls[0]![0]→ TS2493 (indexing past a length-0 tuple)... as CredentialRequestOptions & { mediation?: string }→ TS2352 (casting the resultingundefined)Fix
Give both mocks the real
getsignature(_options?: CredentialRequestOptions)so the recorded call args are typed correctly. Test-only change — no production source touched.Verification
npm run typecheck→ clean (previously failing)npm test→ 101/101 pass🤖 Generated with Claude Code