Skip to content
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
@urish

Description

@urish

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions