Skip to content

Fix TypeScript 5.9.3 Uint8Array type compatibility issues#1532

Merged
ankoh merged 4 commits intorenovate/typescript-5.xfrom
copilot/sub-pr-1346
Feb 3, 2026
Merged

Fix TypeScript 5.9.3 Uint8Array type compatibility issues#1532
ankoh merged 4 commits intorenovate/typescript-5.xfrom
copilot/sub-pr-1346

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

TypeScript 5.9.3 has stricter type definitions for Web APIs that accept binary data. While Uint8Array is accepted at runtime by APIs like Request, Blob, and various buffer operations, the TypeScript type definitions don't recognize this compatibility.

Changes

Fixed 4 compilation errors using type assertions and type adjustments:

  • native_grpc_client.ts: Cast args.body to BodyInit for the Request constructor
  • native_http_client.ts: Changed bodyBuffer type from ArrayBuffer to ArrayBuffer | Uint8Array to accept TextEncoder output
  • web_file_downloader.ts: Cast uint8Array to BlobPart for the Blob constructor

These changes use type assertions to inform TypeScript that Uint8Array is compatible with the expected types, preserving the exact data size without using the .buffer property which could include extra uninitialized data.

Files Modified

  • packages/dashql-app/src/platform/native_grpc_client.ts
  • packages/dashql-app/src/platform/native_http_client.ts
  • packages/dashql-app/src/platform/web_file_downloader.ts

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…nterop

Co-authored-by: ankoh <3986510+ankoh@users.noreply.github.com>
@ankoh
Copy link
Owner

ankoh commented Feb 3, 2026

@copilot please check the actual build errors. I neither want you to add skipLibCheck, nor allowSyntheticDefaultImports, nor esModuleInterop. There are only a handful of typescript errors that need to be fixed with the 5.9 upgrade.

concentrate on those


ERROR in /home/runner/work/dashql/dashql/packages/dashql-app/src/platform/native_grpc_client.ts
./src/platform/native_grpc_client.ts 249:12-16
[tsl] ERROR in /home/runner/work/dashql/dashql/packages/dashql-app/src/platform/native_grpc_client.ts(249,13)
      TS2322: Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BodyInit | null | undefined'.
  Type 'Uint8Array<ArrayBufferLike>' is missing the following properties from type 'URLSearchParams': size, append, delete, get, and 2 more.
 @ ./src/platform/native_hyperdb_client.ts 4:0-99 23:35-72 192:26-42
 @ ./src/connection/hyper/hyperdb_client_provider.tsx 3:0-84 12:31-56
 @ ./src/app.tsx 19:0-92 77:64-91

ERROR in /home/runner/work/dashql/dashql/packages/dashql-app/src/platform/native_http_client.ts
./src/platform/native_http_client.ts 192:16-26
[tsl] ERROR in /home/runner/work/dashql/dashql/packages/dashql-app/src/platform/native_http_client.ts(192,17)
      TS2322: Type 'Uint8Array<ArrayBuffer>' is not assignable to type 'ArrayBuffer'.
  Types of property '[Symbol.toStringTag]' are incompatible.
    Type '"Uint8Array"' is not assignable to type '"ArrayBuffer"'.
 @ ./src/platform/http_client_provider.tsx 4:0-59 14:25-41
 @ ./src/app.tsx 16:0-72 75:56-74

ERROR in /home/runner/work/dashql/dashql/packages/dashql-app/src/platform/native_http_client.ts
./src/platform/native_http_client.ts 194:16-26
[tsl] ERROR in /home/runner/work/dashql/dashql/packages/dashql-app/src/platform/native_http_client.ts(194,17)
      TS2322: Type 'Uint8Array<ArrayBuffer>' is not assignable to type 'ArrayBuffer'.
  Types of property '[Symbol.toStringTag]' are incompatible.
    Type '"Uint8Array"' is not assignable to type '"ArrayBuffer"'.
 @ ./src/platform/http_client_provider.tsx 4:0-59 14:25-41
 @ ./src/app.tsx 16:0-72 75:56-74

ERROR in /home/runner/work/dashql/dashql/packages/dashql-app/src/platform/web_file_downloader.ts
./src/platform/web_file_downloader.ts 6:31-41
[tsl] ERROR in /home/runner/work/dashql/dashql/packages/dashql-app/src/platform/web_file_downloader.ts(6,32)
      TS2322: Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BlobPart'.
  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 not assignable to type 'ArrayBuffer'.
          Types of property '[Symbol.toStringTag]' are incompatible.
            Type '"SharedArrayBuffer"' is not assignable to type '"ArrayBuffer"'.
 @ ./src/platform/file_downloader_provider.tsx 4:0-61 8:93-110
 @ ./src/app.tsx 13:0-80 69:32-54

ERROR in ./src/platform/native_grpc_client.ts:249:13
TS2322: Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BodyInit | null | undefined'.
  Type 'Uint8Array<ArrayBufferLike>' is missing the following properties from type 'URLSearchParams': size, append, delete, get, and 2 more.
    247 |             method: 'POST',
    248 |             headers,
  > 249 |             body: args.body,
        |             ^^^^
    250 |         });
    251 |         const response = await fetch(request);
    252 |         await throwIfError(response);

ERROR in ./src/platform/native_http_client.ts:192:17
TS2322: Type 'Uint8Array<ArrayBuffer>' is not assignable to type 'ArrayBuffer'.
  Types of property '[Symbol.toStringTag]' are incompatible.
    Type '"Uint8Array"' is not assignable to type '"ArrayBuffer"'.
    190 |                 bodyBuffer = init.body;
    191 |             } else if (init.body instanceof URLSearchParams) {
  > 192 |                 bodyBuffer = new TextEncoder().encode(body.toString());
        |                 ^^^^^^^^^^
    193 |             } else if (typeof init.body == "string") {
    194 |                 bodyBuffer = new TextEncoder().encode(body);
    195 |             } else {

ERROR in ./src/platform/native_http_client.ts:194:17
TS2322: Type 'Uint8Array<ArrayBuffer>' is not assignable to type 'ArrayBuffer'.
  Types of property '[Symbol.toStringTag]' are incompatible.
    Type '"Uint8Array"' is not assignable to type '"ArrayBuffer"'.
    192 |                 bodyBuffer = new TextEncoder().encode(body.toString());
    193 |             } else if (typeof init.body == "string") {
  > 194 |                 bodyBuffer = new TextEncoder().encode(body);
        |                 ^^^^^^^^^^
    195 |             } else {
    196 |                 throw Error("fetch body is of unexpected type");
    197 |             }

ERROR in ./src/platform/web_file_downloader.ts:6:32
TS2322: Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BlobPart'.
  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 not assignable to type 'ArrayBuffer'.
          Types of property '[Symbol.toStringTag]' are incompatible.
            Type '"SharedArrayBuffer"' is not assignable to type '"ArrayBuffer"'.
    4 |     async downloadBufferAsFile(uint8Array: Uint8Array, filename: string): Promise<void> {
    5 |         // Create a Blob from the Uint8Array
  > 6 |         const blob = new Blob([uint8Array], { type: 'application/octet-stream' });
      |                                ^^^^^^^^^^
    7 |         // Create a temporary URL for the Blob
    8 |         const url = URL.createObjectURL(blob);
    9 |         // Create an anchor element and trigger the download
    ```
  

Copilot AI changed the title [WIP] Update dependency typescript to ^5.9.3 Add TypeScript 5.9.3 compatibility flags to tsconfig Feb 3, 2026
Copilot AI requested a review from ankoh February 3, 2026 16:35
Copilot AI and others added 2 commits February 3, 2026 16:37
Co-authored-by: ankoh <3986510+ankoh@users.noreply.github.com>
Co-authored-by: ankoh <3986510+ankoh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot please check the actual build errors. I neither want you to add skipLibCheck, nor allowSyntheticDefaultImports, nor esModuleInterop. There are only a handful of typescript errors that n...

Fixed the 4 TypeScript 5.9.3 errors by using type assertions to tell TypeScript that Uint8Array is compatible with the expected types:

  • native_grpc_client.ts: Cast to BodyInit
  • native_http_client.ts: Changed type to ArrayBuffer | Uint8Array
  • web_file_downloader.ts: Cast to BlobPart

Reverted the tsconfig changes (skipLibCheck, esModuleInterop, allowSyntheticDefaultImports). Commit: e7d87a0

Copilot AI changed the title Add TypeScript 5.9.3 compatibility flags to tsconfig Fix TypeScript 5.9.3 Uint8Array type compatibility issues Feb 3, 2026
@ankoh ankoh marked this pull request as ready for review February 3, 2026 17:06
@ankoh ankoh marked this pull request as draft February 3, 2026 17:12
@ankoh ankoh marked this pull request as ready for review February 3, 2026 17:12
@ankoh ankoh merged commit ea87cbd into renovate/typescript-5.x Feb 3, 2026
@ankoh ankoh deleted the copilot/sub-pr-1346 branch February 3, 2026 17:16
ankoh pushed a commit that referenced this pull request Feb 3, 2026
* Update dependency typescript to ^5.9.3

* Fix TypeScript 5.9.3 Uint8Array type compatibility issues (#1532)

---------

Co-authored-by: dashql-renovate[bot] <203421728+dashql-renovate[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants