Skip to content

plugin-sharing declares six separate MinimalLogger types, now divergent after #10556 #10692

Description

@os-warren

Observation filed while landing PR #10691 (the #10556 sink paydown). Not a claim; unassigned. Not fixed there — out of that card's scope.

packages/plugins/plugin-sharing/src declares six separate local types all named MinimalLogger, one per module:

fileshape (after #10691)
bulk-recompute.ts{ info?, warn, error? }
rule-hooks.ts{ info?, warn }
record-share-cascade.ts{ info?, warn }
sharing-rule-provenance.ts{ info?, warn? }
record-orphan-cleanup.ts{ info?: Function, warn?: Function }
bu-tree-recompute.ts{ info?, warn? }
primary-bu-projection.ts{ info?, warn? }

(Seven rows, six of which spell the same name — primary-bu-projection.ts and bu-tree-recompute.ts are byte-identical to each other.)

Why this is worth recording rather than shrugging at

The duplication is not itself the defect; the divergence is. #10556 made bulk-recompute.ts's warn non-optional, and tsc immediately reported two call sites — rule-hooks.ts:240 and record-share-cascade.ts:328 — with the confusing form:

Argument of type 'MinimalLogger | undefined' is not assignable to parameter of type 'MinimalLogger | undefined'.
Type 'MinimalLogger' is not assignable to type 'MinimalLogger'. Two different types with this name exist, but they are unrelated.

Both were repaired in #10691 (their warn is now required too, because they forward into the guaranteed sink). What is left is that three of the seven still declare warn? while three declare warn, under one name, in one package — so the next forwarding edge added between any of them re-opens the same seam, and the diagnostic that reports it names the same type on both sides.

record-orphan-cleanup.ts's { info?: Function, warn?: Function } is a further wrinkle: bare Function accepts any callable, so it neither documents the call shape nor catches an arity mistake.

Note for whoever picks this up

⚠️ Not simply "extract one shared type". Four of the seven declare no error member at all, which deliberately keeps them out of the check:optional-error-sink population (#9754) — collapsing them onto one shape that declares error? would pull four modules into that gate's scope and is a contract decision, not a refactor. The cheap and clearly-correct subset is the three already-identical { info?, warn? } shapes; the rest wants a judgement about what this package's logger contract actually is.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions