Closed
Description
Bug Report
π Search Terms
sufficiently overlaps class namespace
π Version & Regression Information
TS 4.2, TS v4.3.0-dev.20210420
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about compatibility
β― Playground Link
Playground link with relevant code
π» Code
class C1 { foo() {} }
new C1() as Record<string, unknown>; // error, as expected
class C2 { foo() {} }
namespace C2 { export const unrelated = 3; }
new C2() as Record<string, unknown>; // allowed!?
π Actual behavior
The existence of the field in the C2 namespace somehow affects the assignability calculation of the instance.
π Expected behavior
I would expect these namespace-level properties to not get involved (?) in the assignability of instances.
Either both succeed or both fail.