Repository navigation
Closed
Labels
ready-for-agentFully specified, ready for an AFK agent
Description
Parent
Part of #236.
PR base
Open the pull request against spec/236-page-typescript (cut from master), not master. When that branch is missing, create it from origin/master and push it first.
What to build
The option base class of the Page store is TypeScript, so every option subclass inherits a typed constructor and value. The shape comes from the prototype (prototype/option-typing, unmerged):
class Option<Value = unknown, Owner = unknown> {
run: Owner;
value: Value; // bare field, annotation map unchanged
// error: ValidationError | boolean | null
}
// a subclass: extends Option<string[], OptionRun>description and hoverInfo become optional constructor parameters and the options argument gets an OptionSettings interface. No caller changes.
Acceptance criteria
- The option base is one generic class over its value and its owner, as above; it imports no store type
-
descriptionandhoverInfoare optional constructor parameters; the options argument is typed by anOptionSettingsinterface -
erroris typedValidationError | boolean | null(the widening that accommodates MultistateNumber.error returns a boolean, so the option always reports an error #235; that bug is not fixed here) - The JSDoc
yupname diagnostic is cleared by types alone - The 22 baseline lines this clears are deleted: the option base's own line and the "Expected 5-6 arguments" lines in the still-JavaScript alignment options and run options
- Each file is whole-file renamed to
.ts(.tsxwhen it holds JSX), keeps its shape and gains explicit types: no behaviour change, no refactor, no file split, MobX annotation maps untouched - These files have zero diagnostics under plain
tscand under--noImplicitAny, and hold no writtenany -
yarn typecheck:baselinepasses; every baseline line this leaf clears is deleted, and a still-JavaScript caller line whose fingerprint this leaf changes is rewritten in the same change - Every test, script and config entry that opens a renamed file by fixed path uses the new extension; import specifiers stay extensionless
- A Renderer bridge call in these files reads
window.rendererBridgewith no cast, still inside each method (not once at module load), and theRendererBridgemembers these files call are tightened; a crossing payload type lives in main and is imported type-only - A bug typing exposes (a diagnostic that cannot clear without a runtime change) keeps its behaviour, gets the narrowest accommodation (a widened type, else a
@ts-expect-errorwith a one-line reason), is filed as its own issue outside Spec: page TypeScript #236 and is linked from the pull request -
yarn lintandyarn react-testpass, the tests changing only where a fixed path moved;yarn buildstill emits the main, preload and page output -
tsconfig.jsonis unchanged:strictandnoImplicitAnystay off,allowJsstays on
Metadata
Metadata
Assignees
Labels
ready-for-agentFully specified, ready for an AFK agent
Activity