mirror of
https://github.com/luxfi/wallet.git
synced 2026-07-27 03:37:41 +00:00
fix(wallet/pq): satisfy --strict exhaustive-switch narrowing
The switch in walletSchemeName covers every WalletSchemeID enum value, so TypeScript --strict narrows the default arm's `s` to `never` and rejects `s.toString(16)`. Cast through `number` for the forward-compat fallback path. No behaviour change; KAT vector for AccountID derivation (chainID=9000, scheme=0x42) still matches the Go side at 76a03630148103ec558cf4d8f7e8a2d8766ea205d96a4529249c3aaf9c5d078cc9f9fdb8f21a5e7ef6bb4c4ea29c9654.
This commit is contained in:
@@ -56,8 +56,14 @@ export function walletSchemeName(s: WalletSchemeID): string {
|
||||
return 'ml-dsa-65'
|
||||
case WalletSchemeID.MLDSA87:
|
||||
return 'ml-dsa-87'
|
||||
default:
|
||||
return `wallet-scheme(0x${s.toString(16).padStart(2, '0')})`
|
||||
default: {
|
||||
// Forward-compat: a numeric scheme byte that does not match any
|
||||
// known enum case still gets a readable name. The cast to number
|
||||
// is required because the switch above is exhaustive over the
|
||||
// enum and TypeScript narrows `s` to `never` here.
|
||||
const raw = s as number
|
||||
return `wallet-scheme(0x${raw.toString(16).padStart(2, '0')})`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user