fix(@stdlib/array/float16): add missing index signature to Float16Array class declaration#13332
Draft
Planeshifter wants to merge 1 commit into
Draft
Conversation
…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
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request:
lib/node_modules/@stdlib/array/float16/docs/types/index.d.ts. ItsFloat16Arrayclass declaresimplements Float16ArrayInterface(imported from@stdlib/types/array), but was missing a[ index: number ]: numberindex signature required by that interface (it already correctly declaredbuffer,byteLength,byteOffset,BYTES_PER_ELEMENT, andlength). Under this repo's pinnedlib: ["es6"]TypeScript configuration,@stdlib/types/array'sFloat16Arrayconditional type resolves to itsFloat16ArrayFallbackinterface (since there is no nativeFloat16Arrayglobal underes6lib), so the class fails to satisfy it, producingTS2420: Class 'Float16Array' incorrectly implements interface 'Float16ArrayFallback'. This compile error cascades into anevertype anywhere aFloat16Arrayinstance is passed through a generically-typed function, which broke thelint_changed_filesworkflow's "Lint TypeScript declarations test files" step for@stdlib/array/zero-to-likeand@stdlib/array/zeros-likewith errors likeExpected type to be: Float16ArrayFallback, got: never. The same latent break affects@stdlib/array/zerosand@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
None.
Questions
No.
Other
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 Float16ArrayFallbackannotations in the consumer test files were simply typos forFloat16Array) was tried and discarded after a standalonetscrun showed the annotations were already correct and the actual resolved type wasnever— a compile-error signal, not a naming mismatch. Root-caused from there to the missing index signature. Verified with a standalonetscinvocation (lib: ["es6"], matching this repo'sdocs/types/tsconfig.json) against@stdlib/array/zero-to-like's and@stdlib/array/zeros-like'sdocs/types/test.ts: no error at the Float16-related lines with the fix applied, and the originalTS2420plus cascadingnevererrors 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
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
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