Conversation
|
Hey @MasterKale, for my implementation this change introduced a type error. // Before:
publicKey:passkey.publicKey,
// After:
publicKey: new Uint8Array(passkey.publicKey), |
|
@P4sca1 thanks for sharing that, the move to Deno 2.4 (specifically its upgrading to TypeScript 5.7) has I'm sure created a ton of headaches for devs like you. It's definitely making a ton of trouble for library maintainers like me as the " The only way I know to get an "old-style" And as for anything I might do in SimpleWebAuthn to help alleviate this problem, I think I've done all I can. The way I see it it'd have to be Prisma that updates to communicate that it's returning |
This PR refactors @simplewebauthn/browser and @simplewebauthn/server to support use in Deno projects running Deno v2.2+.
Deno v2.2 launched with TypeScript 5.7. In this version of TypeScript,
Uint8Arraywas made generic, to be of typeUint8Array<ArrayBufferLike>. Existing values typed simply asUint8Arraynow needed to be refactored to specify the type of their array buffer:Before
After
Unfortunately "simply refactoring all instances of Uint8Array" to specify a buffer type would break the code in Deno v2.1 and earlier where Uint8Array is not generic.
To support both runtimes, I took a page out of Deno's handbook and defined a new
Uint8Array_type instead. This type is equivalent to non-genericUint8Arrayin Deno v2.1 and earlier, and equivalent toUint8Array<ArrayBuffer>in Deno v2.2 and beyond.I'm not entirely happy with how this bit of Deno runtime changes gets exposed in the public API of the project. I'm keeping my fingers crossed that it'll be transparent to most everyone. A more succinct copy of all of the context above has been included in the docstring for
Uint8Array_for those who go digging.