I'm trying to debug a weird problem I face with TypeScript 3.1, Babel 7 and Webpack 4, where it only works when I build an object manually. Here's an example (pseudo code):
B (see img below):
const objectOfObjects = {...}
const someKeys = ['key1', 'key2', 'key3']
someKeys.filter(key => {
const i = new Foo(objectOfObjects[key]['somePropName'], /* subsequent props */);
console.log(i); // when I inspect the object here values are set correctly
return predicate(i);
});
But instead of having to type that in manually objectOfObjects[key]['somePropName'] for each property, I just pass in an object of a given TypeScript interface, and pass that to the constructor and let it Object.assign it.
A (see img below):
const objectOfObjects = {...}
const someKeys = ['key1', 'key2', 'key3']
someKeys.filter(key => {
const i = new Foo(objectOfObjects[key]);
console.log(i) // this does also return and object, but with all props undefined
return predicate(i);
});
Foo extends the following base class
class FooBase {
constructor(o: IFoo) {
if (o) {
Object.assign(this, o);
}
}
}
When I make a very simple example it seems to be working, but no matter what, when I pass objectOfObjects[key] to the constructor of Foo in my real application I get this:
As I've gone over it and tried to find changes in objectOfObjects[key], the only difference I can think of is what i highlighted in the image above - the little "e" and "t" just to the left of the object in chrome console. I could not find any documentation from a google search, so hopefully one of you knows what it means, and hopefully it could also indicate what I do wrong here.
