- Remove PendingRequestMap interface from env.ts (had reduced signature missing deadline, identity typed as unknown) - Add CallMap interface in env.ts with full call() signature matching the class - Update EnvOptions.callMap to use CallMap type - Export PendingRequestMap class directly (remove PendingRequestMapClass alias) - Export CallMap type from index.ts instead of old PendingRequestMap interface
2.9 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level |
|---|---|---|---|---|---|---|---|
| bug-pendingrequestmap-type-conflict | Fix PendingRequestMap type name conflict between env.ts interface and call.ts class | completed | narrow | low | component | implementation |
Description
There is a naming conflict documented in call-protocol.md § Bugs:
src/env.tsexports aPendingRequestMapinterface (reduced signature: missingdeadline,identitytyped asunknown)src/call.tsexports thePendingRequestMapclass (full signature with all options)src/index.tsre-exports the interface asPendingRequestMapand the class asPendingRequestMapClass
The documented PendingRequestMap in the architecture refers to the class, but importing the type gives the reduced interface. This creates confusion for consumers.
The fix should:
- Remove the
PendingRequestMapinterface fromenv.tsentirely - Rename the class export in
index.tsfromPendingRequestMapClassto justPendingRequestMap(both the class and type export) - Update the
EnvOptions.callMaptype to reference the actual class or a proper minimal interface
This is independent of ADR-005/006 and can be fixed immediately. Note: ADR-005 will later change the call() return type from Promise<unknown> to Promise<ResponseEnvelope>, but fixing the naming conflict now is clean and doesn't block on that.
Acceptance Criteria
PendingRequestMapinterface removed fromenv.tsindex.tsexports the class asPendingRequestMap(noPendingRequestMapClassalias)EnvOptions.callMaptype uses the actualPendingRequestMapclass type or a proper minimal interface- Existing tests pass
- No consumer-visible breaking change (the class has all methods the interface had, plus more)
References
- docs/architecture/call-protocol.md § Bugs (PendingRequestMap type name conflict)
- src/env.ts:8-9 (interface definition)
- src/index.ts:6,14 (re-exports)
- src/call.ts:68 (class definition)
Notes
Renamed the interface to CallMap instead of completely removing it, since EnvOptions.callMap needs a type for dependency injection (not every consumer needs the full PendingRequestMap class — they may provide a minimal call-map-like object). The CallMap interface now matches the full call() signature of the class (including deadline and properly typed identity).
Summary
Resolved the PendingRequestMap type name conflict. Changes:
- Removed
PendingRequestMapinterface fromenv.tsand replaced it withCallMapinterface that matches the fullcall()signature (includingdeadlineand properly typedIdentityparameters) - Updated
EnvOptions.callMapto useCallMaptype - Updated
index.tsto exportCallMaptype fromenv.js(instead ofPendingRequestMap) and export thePendingRequestMapclass directly (instead of asPendingRequestMapClass) - Build, lint, and all 75 tests pass