typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

Missing error when shadowing WeakMap/WeakSet in class private field's scope

Open RyanCavanaugh opened this issue 1 month ago • 1 comments

Steps to reproduce

    function test() {
        let WeakMap;
            ~~~~~~~
!!! error TS18027: Compiler reserves name 'WeakMap' when emitting private identifier downlevel.
        let WeakSet;
            ~~~~~~~
!!! error TS18027: Compiler reserves name 'WeakSet' when emitting private identifier downlevel.
        class C {
            #x;
        }
    }

Behavior with [email protected]

As shown

Behavior with tsgo

No error

Likely just because this transform isn't implemented yet, but logging to document an accepted error delta

RyanCavanaugh avatar Nov 13 '25 23:11 RyanCavanaugh

This would be a checker bug; recordPotentialCollisionWithWeakMapSetInGeneratedCode was not ported.

jakebailey avatar Nov 14 '25 00:11 jakebailey