-
Notifications
You must be signed in to change notification settings - Fork 446
Open
Description
Consider the following code:
async function register() {
const publicKey = PublicKeyCredential.parseCreationOptionsFromJSON({ /* … */ });
const credential = (await navigator.credentials.create({publicKey})) as PublicKeyCredential;
return credential.toJSON();
}
The type of the returned code is any
because:
.toJSON()
returnsPublicKeyCredentialJSON
andPublicKeyCredentialJSON
is defined asany
.
This is fine for some use cases, but it completely removes type safety for accessing any fields on the returned value.
@github/webauthn-json
is winding down, and developers who transition to the built-in functions will gain some benefits at the expense of losing these types.
I'd be happy to contribute full types for these, since the actual types can be ported and adapted from @github/webauthn-json
somewhat directly. However, I'm not clear on how to integrate this into TypeScript-DOM-lib-generator
, as it would be a lot to add to overridingTypes.jsonc
.
Metadata
Metadata
Assignees
Labels
No labels