TypeScript Version: 3.9.0-dev.20200225
Search Terms: uninitialized not initialized class property in operator
Code
Looks like the same code that in JavaScript actually adds a non-static property to an instance, in TypeScript, however, does not.
class Thing {
property;
}
const thing = new Thing();
console.log("property" in thing);
Expected behavior:
logs true

Actual behavior:
logs false

Playground Link: https://www.typescriptlang.org/play/?noImplicitAny=false&ts=3.9.0-dev.20200225#code/MYGwhgzhAEAqAWBLAdgc2gbwFAEgAOATgPZ4CmBALgJ4DcWAvllsEchBdBUmtALzTJSAdzjdUACgCUdZqwhEQpAHQgiEgESES5auugpOY6ViA
Related Issues: (none)
TypeScript Version: 3.9.0-dev.20200225
Search Terms: uninitialized not initialized class property in operator
Code
Looks like the same code that in JavaScript actually adds a non-static property to an instance, in TypeScript, however, does not.
Expected behavior:
logs
trueActual behavior:
logs
falsePlayground Link: https://www.typescriptlang.org/play/?noImplicitAny=false&ts=3.9.0-dev.20200225#code/MYGwhgzhAEAqAWBLAdgc2gbwFAEgAOATgPZ4CmBALgJ4DcWAvllsEchBdBUmtALzTJSAdzjdUACgCUdZqwhEQpAHQgiEgESES5auugpOY6ViA
Related Issues: (none)