ReviewOS

home-lang/home

fix(ts): transfer checked-JS finite JSDoc object annotations across imports

#947
Closed glennmichael123 opened this 7 days ago ·
7 days ago

Parent: #846.

Fresh TypeScript 5.7.3 real-file control: a checked JavaScript owner exports /** @type */ const settings = { count: 1, label: "ready" }; a TypeScript importer writes a string to count, a number to label, and reads missing. TypeScript reports TS2322, TS2322, TS2339 at the respective consumer lines. Freshly rebuilt Home reported no diagnostics. The equivalent TypeScript-owned declaration and the unannotated JavaScript object both already produce the three errors in Home, and the checked-JS owner itself understands the annotation. Thus the loss is specifically at Program declaration-schema transfer: jsdoc_types marked finite object type text unsupported, so a source-owned object type was not available to the importer.

Acceptance: source-owned finite JSDoc object members preserve required, nested, optional, and readonly semantics across admitted JS imports; unsupported methods/index signatures are not misrepresented as closed data properties; real CLI agrees with TypeScript on positive and negative controls; Program/parser/CLI/checker regressions pass under the 3,840 MB serial memory guard. A pre-existing optional-property assignment wording mismatch also reproduces with a TypeScript-owned declaration; track separately rather than hiding it here.

7 days ago

Implemented and pushed directly to origin/main as glennmichael123 (no coauthors): 3c143a5. Program now transfers finite source-owned JSDoc object members, including nested, optional, and readonly fields; method/index/computed-member syntax remains conservatively unsupported instead of being misrepresented as a closed object. Regression coverage includes the parser and an admitted checked-JS import with no global checkJs option, plus a JS-owner revision case under #846. Guarded Program 425/425 and CLI 85/85 pass; checker target is cached-valid because checker source is unchanged. Fresh home-tsc and TypeScript 5.7.3 emit the same three codes, positions, and messages for the plain checked-JS object write/read control. The richer optional/readonly/nested control matches four codes and positions, but the optional-property TS2322 wording diverges identically with a TypeScript-owned declaration; that independent checker diagnostic gap is now #948. This issue closes the cross-import object-transfer defect only, not all of #846.

7 days ago

Follow-up: the separate optional-property diagnostic wording mismatch noted at closure is now fixed by #948 / 5e31d08 on origin/main. The rich checked-JS object import control now matches TypeScript 5.7.3 on all four codes, positions, and messages; guarded checker 4685, Program 425, CLI 85 pass. #846 remains the broader open parent.

Sign in to comment on this issue.