You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix TypeScript 5.9 compatibility issues with BufferSource types #423
GitHub Actions workflows are failing due to type errors after Deno automatically upgraded to version 2.5, which includes TypeScript 5.9.2. The type errors occur when passing Uint8Array<ArrayBufferLike> to functions expecting BufferSource.
Error details
The following type errors are occurring in packages/fedify/src/runtime/key.ts:
Argument of type 'Uint8Array<ArrayBufferLike>' is not assignable to parameter of type 'BufferSource'.
Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'ArrayBufferView<ArrayBuffer>'.
Types of property 'buffer' are incompatible.
Type 'ArrayBufferLike' is not assignable to type 'ArrayBuffer'.
Type 'SharedArrayBuffer' is missing the following properties from type 'ArrayBuffer':
resizable, resize, detached, transfer, transferToFixedLength
Affected lines:
Line 42: crypto.subtle.importKey() with "pkcs8" format
Line 114: crypto.subtle.importKey() with "spki" format
Line 122: crypto.subtle.importKey() with "raw" format
Root cause
Deno 2.5 upgraded TypeScript from 5.8.3 to 5.9.2
TypeScript 5.9 includes changes to lib.d.ts that make ArrayBufferLike and ArrayBuffer types incompatible
The new ArrayBuffer type in TypeScript 5.9 includes additional properties that SharedArrayBuffer doesn't have
Solution
Instead of downgrading Deno, we should fix the type compatibility issues properly. The Uint8Array instances need to be cast or ensured to use ArrayBuffer instead of ArrayBufferLike when passed to Web Crypto API methods.
assertEquals(await store.get(["foo", "baz"]), undefined); failed with value "baz", which means the ttl options don't work properly. It's another issue anyway; it makes the test fail.
EDIT: After adding await new Promise((resolve) => setTimeout(resolve, 1000)); between 15 and 16, the overall test passed.
Activity
dodok8 commentedon Sep 11, 2025
Line 36 was also affected. I'd like to handle this issue.
dodok8 commentedon Sep 11, 2025
Currently, I'm working on this branch: https://github.com/dodok8/fedify/tree/dodok8-issue-399
However,
federation/kv.test.tsis failing on my local machineassertEquals(await store.get(["foo", "baz"]), undefined);failed with value"baz", which means thettloptions don't work properly. It's another issue anyway; it makes the test fail.EDIT: After adding
await new Promise((resolve) => setTimeout(resolve, 1000));between 15 and 16, the overall test passed.