Skip to content

Commit 989f07f

Browse files
Copilotrotu
andauthored
Address code review: clarify doc wording and add explicit type guard in typedArray
Agent-Logs-Url: https://github.com/rotu/structview/sessions/3465639d-8c89-4269-94e2-6dbf1256113f Co-authored-by: rotu <119948+rotu@users.noreply.github.com>
1 parent d4695a3 commit 989f07f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fields.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ export function bool(fieldOffset: number): StructPropertyDescriptor<boolean> {
327327
* })
328328
* ```
329329
*
330-
* **Predicate function** — the field is absent when `(dv: DataView) => boolean`
331-
* returns `false`. Setting the field to a non-null value writes it normally;
330+
* **Predicate function** — the field is absent when the predicate returns
331+
* `false`. Setting the field to a non-null value writes it normally;
332332
* setting to `null` is a no-op.
333333
*
334334
* ```ts
@@ -478,7 +478,7 @@ export function typedArray<T>(
478478
lengthValue = length
479479
} else if (typeof length === "string") {
480480
lengthValue = Reflect.get(this, length)
481-
} else {
481+
} else if (typeof length === "function") {
482482
lengthValue = length(dv)
483483
}
484484
return new species(

0 commit comments

Comments
 (0)