Conversation
Parse lists like `string[] = ['localhost']` and `number[] = [3000, 8080]` as fresh-array thunks, matching `= []`. Co-authored-by: Yam Borodetsky <hi@yam.codes>
The package build rejects an unnarrowed quote token and a root that has not been checked as a unit. Co-authored-by: Yam Borodetsky <hi@yam.codes>
58661be to
932a786
Compare
There was a problem hiding this comment.
Important
A unit-literal array default followed by trailing whitespace loses its type-level default value — the reconstructed literal collapses to never.
Reviewed changes
- Unit-literal array defaults —
parseDefaultnow recognizes[...]after=, parsing each element as a unit literal at runtime (parseUnitLiteralArray/parseUnitLiteralElement) and mirroring the same grammar at the type level, then returning a fresh-array thunk like[]does (withDateelements cloned per traversal). - Tests — 11 new cases in
objects/defaults.test.tscovering both quote styles, interior whitespace and trailing commas, fresh-array semantics, and rejection of non-literal elements, unassignable elements, non-array bases, and trailing junk.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ Delta is clean — no new issues since the prior review.
Reviewed changes (since the prior review)
enclosedUnithelper — factors theparseEnclosedcall plus ahasKind("unit")guard out of both the quoted-string andd'/d"element branches ofparseUnitLiteralElement. Behavior is unchanged (valid literals always produce aunitnode, so the guard never fires) and it resolves the build typecheck that previously read.unitoff an unnarrowedBaseRoot.
The trailing-whitespace finding from the previous review is not touched by this commit and remains open.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Trailing spaces after the closing bracket were part of the stored literal, so the type collapsed to never while runtime still accepted the default. Co-authored-by: Yam Borodetsky <hi@yam.codes>
|
@pullfrog review |
There was a problem hiding this comment.
Important
Two inputs the runtime parser accepts are rejected at the type level — date elements and numeric tokens that JS rounds. Both are detailed inline.
Reviewed changes
- Unit-literal array defaults —
parseDefaultnow recognizes[...]after=in string definitions, parsing each element as a unit literal at runtime (parseUnitLiteralArray/parseUnitLiteralElement) and mirroring the grammar at the type level (parseUnitLiteralArray/parseUnitElement), then returning a fresh-array thunk like[]does (withDateelements cloned per traversal). - Trailing-whitespace fix — the latest commit routes the type-level branch through
Scanner.skipWhitespace/trimso= ['a']no longer collapses the default type tonever; the prior review's finding is addressed. - Tests — 11 new cases in
ark/type/__tests__/objects/defaults.test.tscovering both quote styles, interior whitespace and trailing commas, fresh-array semantics, and rejection of non-literal/unassignable elements, non-array bases, and trailing junk.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Date prefixes were parsed as plain strings, and numbers JavaScript cannot represent exactly were rejected even though the runtime accepts them. Co-authored-by: Yam Borodetsky <hi@yam.codes>
|
@pullfrog review |
There was a problem hiding this comment.
ℹ️ No blocking issues — both prior findings are fixed. Two minor follow-ups below.
Reviewed changes (delta against the prior pullfrog review)
- Date elements now reachable at the type level —
parseUnitElementmatches thed'/d"prefix before the generic quote branch, soDate[] = [d'2020-01-01']resolves toDefault<Date[], [Date]>instead ofnever. - Inexact numbers infer as
number— thenumber extends n ? neverguard was dropped frominferUnenclosedElement, so tokens JS rounds (e.g.9007199254740993) infernumber, matching the runtime and the scalar default path. - Tests — added "array default accepts date elements" and "array default accepts a number that is not an exact literal".
ℹ️ String-syntax docs still describe only empty collection defaults
ark/docs/content/docs/objects/index.mdx:167 states "An empty array or object can be defaulted directly in string syntax" and shows only = [] / = {}. With non-empty unit-literal arrays now supported, that paragraph and its example are incomplete. Note that a docs edit also requires regenerating ark/docs/public/llms.txt.
Technical details
# Document non-empty array defaults in string syntax
## Affected sites
- `ark/docs/content/docs/objects/index.mdx:167-175` — prose and example cover only `= []` / `= {}`.
- `ark/docs/public/llms.txt` — generated from docs `.mdx` files by `writeLlmsTxt()`; must be regenerated after any docs-content edit.
## Required outcome
- The string-syntax defaults paragraph/example should mention that `= ['a']` / `= [1, 2]` are accepted and produce a fresh array per traversal.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
The objects page only described empty `= []` and `= {}` defaults.
Co-authored-by: Yam Borodetsky <hi@yam.codes>
|
@pullfrog review |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (delta since the prior pullfrog review)
The only commit since the prior pullfrog review (ff9033c6) is the docs update, so I re-verified the full feature at head rather than only the docs.
- Docs updated —
ark/docs/content/docs/objects/index.mdxand its generatedark/docs/public/llms.txtnow describe unit-literal array defaults alongside the empty-collection forms, withhosts/portsexamples, resolving the prior review's open docs finding.
I confirmed the committed llms.txt is exactly what writeLlmsTxt() regenerates, and spot-checked type/runtime parity for bigint, escaped-quote, bracket-in-string, undefined, negative-number, and nested-array (rejected) elements — all consistent with the scalar path.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Resolves #1661
Summary
Allow a unit-literal array after
=in string syntax, with either quote style:Each traversal gets a fresh array, the same way
= []does. Computed defaults stay on the tuple form (["string[]", "=", () => ["localhost"]]).Checklist
ark/type/__tests__/objects/defaults.test.tsmainpnpm -r --filter !@ark/docs build), which is what thecorecheck failed onpnpm prCheckswas not run locally; CI still runs lint, tests, and benches