Problem
Home reports false TS2304 diagnostics for default-lib generic collection interfaces in ordinary type annotations:
const weak: WeakMap<object, boolean> = new WeakMap();
declare const readonlyMap: ReadonlyMap<string, number>;
declare const readonlySet: ReadonlySet<string>;TypeScript 6.0.3 and the TypeScript 7 native preview accept these declarations. This also accounts for four unique TS2304 diagnostics in the pinned Zod corpus (WeakMap twice, ReadonlyMap, and ReadonlySet).
Root cause
The generic type-reference resolver has semantic builders for Map, Set, and WeakSet, but no WeakMap arm and no read-only collection builders. Its generic-name acceptance registry also omits WeakMap, WeakSet, ReadonlyMap, and ReadonlySet.
Fair oracle
Positive:
WeakMap<object, boolean>resolves and exposes its standard methods.ReadonlyMap<string, number>exposes read methods.ReadonlySet<string>exposes read methods.- TypeScript 6.0.3 and TypeScript 7: 0 diagnostics.
- Home parent: 3 false
TS2304diagnostics.
Negative controls:
MissingCollection<string>must remainTS2304.ReadonlyMap#setandReadonlySet#addmust remainTS2339.
Acceptance criteria
- Resolve the default-lib collection interfaces through shared semantic collection construction, not name suppression.
- Preserve key/value and method result types.
- Do not expose mutable-only members on read-only interfaces.
- Preserve the negative controls in parity with TypeScript 6 and 7.
- Add permanent regression coverage.
- Re-run the pinned Zod corpus and document the result in the TypeScript performance audit and README.