mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
20 lines
846 B
TypeScript
20 lines
846 B
TypeScript
// Uses of a binding whose DECLARATION was blocked report the SC2004
|
|
// cascade — "inherits the blocker on its declaration" — instead of
|
|
// misattributing the reference itself. The root diagnostic stays on the
|
|
// declaration site; every use points back at it.
|
|
|
|
// A poisoned declaration (WeakMap values are fenced, and the type can't
|
|
// be salvaged): uses of 'w' cascade — reads and writes alike. (This
|
|
// battery used Symbol before symbol values grew a lowering.)
|
|
let w = new WeakMap<object, number>();
|
|
console.log(typeof w);
|
|
w = new WeakMap<object, number>();
|
|
|
|
// A signature-blocked function (WeakMap return type) used as a value: the
|
|
// deferred signature diagnostic flushes at the reference, and the value
|
|
// use itself cascades.
|
|
function makeWm(): WeakMap<object, number> {
|
|
return new WeakMap<object, number>();
|
|
}
|
|
const f = makeWm;
|