Skip to content

Comment on The TypeScript Taxparent

Comments

`const testVar = {}` doesn't mean that the object is immutable, it means that testVar will never point to something else.

He's not saying that TypeScript complains because he thinks TypeScript considers testVar immutable here. TypeScript will complain because it will infer the type of testVar is an object with no properties, and `testVar.asdf = "asdf";` is an attempt to write to a nonexistent property.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.