Check out ./src/repro.ts
class P {
do() { console.log('d'); }
}
const x = new P();
console.log('for in:');
for (const key in x) {
console.log(key);
}
I'm using this configuration file ./tsconfig.json
to compile it (tried different configurations):
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"lib": ["ES6"],
"esModuleInterop": true,
"noImplicitAny": true,
"strictNullChecks": true,
"moduleResolution": "node",
"sourceMap": false,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": ["node_modules/*", "src/types/*"]
}
},
"include": ["src/**/*"]
}
Execution:
> tsc -v
Version 4.3.5
> tsc ./src/repro.ts
Output file ./src/repro.js
var P = /** @class */ (function () {
function P() {
}
P.prototype["do"] = function () { console.log('d'); };
return P;
}());
var x = new P();
console.log('for in:');
for (var key in x) {
console.log(key);
}
Running the file:
> node ./src/repro.js
for in:
do
My question is, why does this command not output the method "do":
> ts-node ./src/repro.ts
for in: