Skip to content

fix(@stdlib/array/float16): add missing index signature to Float16Array class declaration#13332

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/ci-fix-float16array-type-test-expectation-2026-07-06
Draft

fix(@stdlib/array/float16): add missing index signature to Float16Array class declaration#13332
Planeshifter wants to merge 1 commit into
developfrom
philipp/ci-fix-float16array-type-test-expectation-2026-07-06

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • Fixes lib/node_modules/@stdlib/array/float16/docs/types/index.d.ts. Its Float16Array class declares implements Float16ArrayInterface (imported from @stdlib/types/array), but was missing a [ index: number ]: number index signature required by that interface (it already correctly declared buffer, byteLength, byteOffset, BYTES_PER_ELEMENT, and length). Under this repo's pinned lib: ["es6"] TypeScript configuration, @stdlib/types/array's Float16Array conditional type resolves to its Float16ArrayFallback interface (since there is no native Float16Array global under es6 lib), so the class fails to satisfy it, producing TS2420: Class 'Float16Array' incorrectly implements interface 'Float16ArrayFallback'. This compile error cascades into a never type anywhere a Float16Array instance is passed through a generically-typed function, which broke the lint_changed_files workflow's "Lint TypeScript declarations test files" step for @stdlib/array/zero-to-like and @stdlib/array/zeros-like with errors like Expected type to be: Float16ArrayFallback, got: never. The same latent break affects @stdlib/array/zeros and @stdlib/array/zero-to, which reference the identical type but weren't touched by a PR in this failure window. The fix adds the missing index signature, matching the interface's own declaration verbatim.

Related Issues

Does this pull request have any related issues?

None.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Found and fixed as part of automated CI-failure triage. Example failing run: https://github.com/stdlib-js/stdlib/actions/runs/28756237389 (job: lint_changed_files / "Lint TypeScript declarations test files", package @stdlib/array/zero-to-like); the same signature also failed for @stdlib/array/zeros-like.

Validation: an initial hypothesis (that the $ExpectType Float16ArrayFallback annotations in the consumer test files were simply typos for Float16Array) was tried and discarded after a standalone tsc run showed the annotations were already correct and the actual resolved type was never — a compile-error signal, not a naming mismatch. Root-caused from there to the missing index signature. Verified with a standalone tsc invocation (lib: ["es6"], matching this repo's docs/types/tsconfig.json) against @stdlib/array/zero-to-like's and @stdlib/array/zeros-like's docs/types/test.ts: no error at the Float16-related lines with the fix applied, and the original TS2420 plus cascading never errors reproduce when the fix is reverted. Reviewed by three independent passes (correctness, regression scope, style/conventions); all approved with no blocking findings. This is a declaration-only (.d.ts) change with no runtime/JS behavior impact.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code as part of an automated CI-failure triage and fix routine, based on live GitHub Actions job log analysis. The fix was reviewed by three independent automated review passes before being proposed here.


@stdlib-js/reviewers


Generated by Claude Code

…ay class declaration

The `lint_changed_files` workflow's "Lint TypeScript declarations test
files" step failed for `@stdlib/array/zero-to-like` and
`@stdlib/array/zeros-like` (and, latently, `@stdlib/array/zeros` and
`@stdlib/array/zero-to`) with e.g.:

  docs/types/test.ts:32:2  error  Expected type to be:
  Float16ArrayFallback, got: never  expect-type/expect

Root cause: `@stdlib/types/array`'s `Float16ArrayFallback` interface
requires a `[ index: number ]: number` index signature (in addition to
`buffer`, `byteLength`, `byteOffset`, `BYTES_PER_ELEMENT`, and
`length`, which were already present). Under this repo's pinned
`lib: ["es6"]` TypeScript configuration, `@stdlib/types/array`'s
`Float16Array` conditional type resolves to `Float16ArrayFallback`,
and `@stdlib/array/float16`'s `Float16Array` class declares
`implements Float16ArrayInterface` but was missing that index
signature, producing `TS2420: Class 'Float16Array' incorrectly
implements interface 'Float16ArrayFallback'`. This compile error
cascades into a `never` type anywhere a `Float16Array` instance flows
through a generically-typed function, breaking `$ExpectType` checks
in consumer packages.

This commit adds the missing index signature to the class, matching
the interface it implements verbatim.

Ref: https://github.com/stdlib-js/stdlib/actions/runs/28756237389
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
array/float16 $\\color{red}2555/2603$
$\\color{green}+98.16\\%$
$\\color{red}452/467$
$\\color{green}+96.79\\%$
$\\color{red}58/59$
$\\color{green}+98.31\\%$
$\\color{red}2555/2603$
$\\color{green}+98.16\\%$

The above coverage report was generated for the changes in this PR.

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.

3 participants