If TypeScript is a strict superset of JavaScript, why is dot notation on an arbitrary object erroneous? I have JS code that I want to convert over to TS for better type safety, but all access using dot notation (eg, myObj.thing
) gives me the error Property 'thing' does not exist on type '{}'.
. It works properly when I use bracket notation (eg, myObj['thing']
).