diff options
author | Matthew Miller <matthew@millerti.me> | 2022-06-20 10:54:16 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2022-06-20 10:54:16 -0700 |
commit | 379ff5c35c7578aed1ff2b78263ab3c2dd2f4873 (patch) | |
tree | 221c2ff6b020a3c0b01b98989b68746cf2e9dd10 /packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts | |
parent | 84d931ea0aadc249a72cfd422b912dec0d52f995 (diff) |
Attempt to cast PublicKeyCredential for new method
Diffstat (limited to 'packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts')
-rw-r--r-- | packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts b/packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts index d0a5ca6..575d2f1 100644 --- a/packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts +++ b/packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ +import { PublicKeyCredentialFuture } from '@simplewebauthn/typescript-types'; /** * Determine if the browser supports conditional UI, so that WebAuthn credentials can * be shown to the user in the browser's typical password autofill popup. @@ -10,10 +11,16 @@ export async function browserSupportsWebAuthnAutofill(): Promise<boolean> { return true; } + /** + * I don't like the `as unknown` here but there's a `declare var PublicKeyCredential` in + * TS' DOM lib that's making it difficult for me to just go `as PublicKeyCredentialFuture` as I + * want. I think I'm fine with this for now since it's _supposed_ to be temporary, until TS types + * have a chance to catch up. + */ + const globalPublicKeyCredential = PublicKeyCredential as unknown as PublicKeyCredentialFuture; + return ( - // @ts-ignore - PublicKeyCredential.isConditionalMediationAvailable - // @ts-ignore - && PublicKeyCredential.isConditionalMediationAvailable() + globalPublicKeyCredential.isConditionalMediationAvailable + && globalPublicKeyCredential.isConditionalMediationAvailable() ); } |