diff --git a/src/defs/types.ts b/src/defs/types.ts index 3e9edb5..cd601d8 100644 --- a/src/defs/types.ts +++ b/src/defs/types.ts @@ -39,7 +39,7 @@ export function paramNumber(value: ParamValue | undefined, fallback: number): nu } /** Spells a refused value for the caller who wrote it; JSON spells NaN and the infinities `null`. */ -export function valueText(value: unknown): string { +export function valueText(value: ParamValue): string { return typeof value === 'number' ? String(value) : JSON.stringify(value); } diff --git a/test/types.test.ts b/test/types.test.ts index c55cc86..c855106 100644 --- a/test/types.test.ts +++ b/test/types.test.ts @@ -42,7 +42,6 @@ describe('integers', () => { const notANumber = types.int8.write(NaN, Buffer.alloc(1), 0); - // JSON spells NaN and the infinities `null`, which is a value the caller never wrote. assert.ok(notANumber.err instanceof Error); assert.match(notANumber.err.message, /NaN/); }); diff --git a/todo.md b/todo.md index 4577653..9d6f8b3 100644 --- a/todo.md +++ b/todo.md @@ -419,7 +419,8 @@ and is also what the panel ranked hardest — two methods, one answer. `idleTimeout: '5000'` is refused with `got 5000` — a value the reader reads as correct — where `connectTimeout` quotes it. `namedValue()`'s four sites — `messagingMode`, `encoding`, the time options and `smsIdFormat` — are the same defect once more: there `true` and `'true'` both print - as `true`. One fix closes all three. Raised by review, 2026-09-20. + as `true`. One fix closes all three, and `valueText()` in `defs/types.ts` is the quoted + spelling to take it from. Raised by review, 2026-09-20. - [ ] **A send the codec will refuse waits for a link and a window slot first.** `refuse()` in `outgoing-requests.ts` runs `misuse()` and the abort check before the wait, precisely so a call