Skip to content

typescript: a structural pair needs matching arity and a class that can reach the interface - #1796

Merged
swapnilpaliwal-sd merged 3 commits into
apps/integration-0.1.9from
apps/typescript/structural-satisfaction-by-name-only
Sep 30, 2026
Merged

swapnilpaliwal-sd merged 3 commits into
apps/integration-0.1.9from
apps/typescript/structural-satisfaction-by-name-only

Conversation

@swapnilpaliwal-sd

Copy link
Copy Markdown
Contributor

TypeScript structural satisfaction paired a class with an interface whenever it had a member of each required name. Pairs across unrelated services became dispatch edges, came back as "verified" one-hop paths, and impact reported them as "must change - it implements this".

  • Arity: a pair needs the source method to take no more required parameters than the target declares.
  • Reachability: the class, or a module that uses it as a value, has to reach the interface's module through imports and re-exports. Some pairs pass without the walk: both sides in one tsconfig program or one module, a library target, or a global script.
  • Opaque imports: where the walk stops at an import it cannot follow (absent package build output, a compiled .d.ts), an import that names the interface counts as reaching it.
  • Private and protected methods: these never satisfy an interface member.
  • impact: a pair with only structural evidence is no longer "must change".
  • Tests: golden case 03-structural-satisfaction gains Bus (arity), Stranger (unreachable), a private-member case and Declared (opaque import). Controls keep their edges: Duck assigned to a Pub slot, the nominal Real, and Declared. Each rule was checked by disabling it, which makes the case fail.
  • Checked: TS golden suite 97/97. Plugin TS cases 168/173; the same 5 checks also fail on the base. On a TS monorepo, multi_inferred edges went 640 -> 617 (all removed targets crossed services), known edges 2272 unchanged, probes 29/73 before and after with none regressed.

swapnilpaliwal-sd and others added 3 commits September 29, 2026 15:55
…an reach the interface

A class was counted as implementing an interface whenever it declared a member of each
required name. Now a covered method that needs more arguments than the target passes
rejects the pair, and outside one tsconfig program the class's module (or a module that
uses the class as a value) must import the interface's module. impact never promotes a
structural pair to 'must change', and a via-the-interface row reached only structurally
is at most one of a set.

Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
…e member

The compiler rejects assigning a class whose only member of a required name is private,
protected or #private, so the structural rule no longer counts such a class as a conformer.
The structural-satisfaction case gains a same-arity class with a private method, built in the
interface's module, that must not become a dispatch candidate.

Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
… lets its class meet it

The reachability gate walks imports from the class's modules to the interface's
module. A workspace package whose manifest points at absent build output, or a
compiled .d.ts, binds no client module, so the walk stopped there and dropped true
conformers (a class declaring implements through such a package, or one built by a
factory module that imports the interface that way). An import in a reached module
that names the interface now counts as the meeting.

Control Declared in 03-structural-satisfaction: without the rule it loses
Relay.run -> Declared.publish; Stranger and Bus stay absent.

Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
@swapnilpaliwal-sd
swapnilpaliwal-sd merged commit 19de79b into apps/integration-0.1.9 Sep 30, 2026
12 checks passed
@swapnilpaliwal-sd
swapnilpaliwal-sd deleted the apps/typescript/structural-satisfaction-by-name-only branch September 30, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant