Skip to content

test(browser): fix TS6 typecheck errors in ceremonies mediation test#87

Merged
wolpert merged 1 commit into
mainfrom
fix/ceremonies-typecheck-ts6
Jun 21, 2026
Merged

test(browser): fix TS6 typecheck errors in ceremonies mediation test#87
wolpert merged 1 commit into
mainfrom
fix/ceremonies-typecheck-ts6

Conversation

@wolpert

@wolpert wolpert commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the tsc --noEmit (npm run typecheck) failures in clients/passkeys-browser/test/ceremonies.test.ts.

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:

  • mock.calls[0]![0]TS2493 (indexing past a length-0 tuple)
  • ... as CredentialRequestOptions & { mediation?: string }TS2352 (casting the resulting undefined)

Fix

Give both mocks the real get signature (_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

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>
@sonarqubecloud

Copy link
Copy Markdown

@wolpert

wolpert commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

@bernata Can you review this PR? It's a fix for npm run typecheck failing.

Also, should I add the typecheck run to the CI process?

@bernata

bernata commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

@bernata Can you review this PR? It's a fix for npm run typecheck failing.

Also, should I add the typecheck run to the CI process?

I'm all for adding more strict type checking.

@wolpert
wolpert merged commit 712c8dc into main Jun 21, 2026
8 checks passed
@wolpert
wolpert deleted the fix/ceremonies-typecheck-ts6 branch June 21, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants