This repository was archived by the owner on Oct 5, 2021. It is now read-only.
This repository was archived by the owner on Oct 5, 2021. It is now read-only.
Endless recursion in getTypeName()
#66
Closed
Description
This happens when an object contains a getter that calls another function, passing the original object as a parameter.
For example, the following code will make TypeWiz throw a RangeError
at runtime:
function log(o: { someVal: number }) {
console.log(o);
}
function f(o: { someVal: number }) {
return o.someVal;
}
const obj = {
get someVal() {
// this will cause TypeWiz to enter an endless recursion when it tries to enumerate to object's keys:
log(this);
return 5;
}
};
f(obj);
Found while working on immerjs/immer#128