Skip to content

fix: keep the animated-image test fixtures BlobPart-compatible under TypeScript >= 5.7 - #371

Merged
AminDhouib merged 1 commit into
devfrom
fix/animated-fixture-types
Sep 2, 2026
Merged

fix: keep the animated-image test fixtures BlobPart-compatible under TypeScript >= 5.7#371
AminDhouib merged 1 commit into
devfrom
fix/animated-fixture-types

Conversation

@AminDhouib

Copy link
Copy Markdown
Member

Unblocks the three npm dependabot PRs (#351, #355, #356), whose rebased lockfiles float typescript 5.6.3 → 5.9.3 and all fail Typecheck the same way.

The defect

PR #365's animated-image test fixtures postdate #368's Uint8Array-generics sweep (which was verified at dev 9b381b8b, before #365 merged) and reintroduce the same pattern: explicit : Uint8Array return annotations, which on TypeScript ≥ 5.7 mean Uint8Array<ArrayBufferLike> — not assignable to BlobPart.

RED, from the live Typecheck failure on #355's rebase (7 errors, all @upupjs/core):

tests/steps/animated-image-detection.test.ts(26,22): error TS2322: Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BlobPart'.
tests/steps/image-processing.test.ts(171,13): error TS2345: Argument of type 'Uint8Array<ArrayBufferLike>' is not assignable to parameter of type 'BlobPart | undefined'.
(+ 228, 242, 270, 289, and the ELIFECYCLE exit 2)

The fix (same convention as #368)

  • tests/helpers/animated-image-fixtures.ts: dropped the 12 explicit : Uint8Array return annotations — inference from new Uint8Array(number[]) yields the narrow Uint8Array<ArrayBuffer> on TS ≥ 5.7 and plain Uint8Array on ≤ 5.6.
  • tests/steps/image-processing.test.ts: the animated table annotation [string, string, Uint8Array][][string, string, BlobPart][] (valid on both TS versions; the bytes only ever feed makeUploadFile, whose parameter is BlobPart). Note Uint8Array<ArrayBuffer> syntax was NOT an option — it's a parse error on TS ≤ 5.6.

Test-only; no runtime or published-surface change, so no changeset.

Verification (raw exit codes)

  • GREEN under the float: pnpm update -r typescript (lands typescript@5.9.3, same resolution as the dependabot lockfiles; angular held at 5.6.3 by fix: make Blob/BodyInit fixture types and the Angular TS pin survive a lockfile float (#351 unblock) #368's ~5.6.0 pin) → tsc --version prints 5.9.3 → @upupjs/core typecheck (base + tsconfig.test.json) exit 0.
  • GREEN under the committed lockfile: scaffolding reverted, pnpm install --frozen-lockfile exit 0, tsc --version prints 5.6.3, core typecheck exit 0.
  • Pre-commit hook ran the core suite (337 passed / 41 skipped); pre-push ran full typecheck + lint + knip.
  • Touched files are outside packages/*/src (CI-blind for formatting): explicit prettier --check on both — clean.

@codesandbox

codesandbox Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@AminDhouib
AminDhouib merged commit e0786f2 into dev Sep 2, 2026
18 checks passed
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.

1 participant