fix: avoid eval in makeInspectable
This commit is contained in:
parent
4bd57316a1
commit
927ff1cf4e
1 changed files with 1 additions and 2 deletions
|
@ -47,8 +47,7 @@ export function makeInspectable<T>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// dirty hack to set name for inspect result
|
// dirty hack to set name for inspect result
|
||||||
// eslint-disable-next-line ts/no-implied-eval, no-new-func
|
const proto = ({ [obj.name]: class {} })[obj.name].prototype
|
||||||
const proto = new Function(`return function ${obj.name}(){}`)().prototype
|
|
||||||
|
|
||||||
obj.prototype.toJSON = function () {
|
obj.prototype.toJSON = function () {
|
||||||
const ret: any = Object.create(proto)
|
const ret: any = Object.create(proto)
|
||||||
|
|
Loading…
Reference in a new issue