This does not work with inherited properties
ehmicky opened this issue · 2 comments
ehmicky commented
The following example fails:
class A { static func() {} }
class B extends A {}
class C {}
mimicFn(C, B)
t.is(C.func, B.func)
This is because we are using Reflect.ownKeys()
which does not retrieve inherited properties.
One way to solve this would be to call Object.setPrototypeOf(C, Object.getPrototypeOf(B))
.
sindresorhus commented
One way to solve this would be to call Object.setPrototypeOf(C, Object.getPrototypeOf(B)).
👍 And should be documented.