sindresorhus/mimic-function

This does not work with inherited properties

ehmicky opened this issue · 2 comments

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)).

One way to solve this would be to call Object.setPrototypeOf(C, Object.getPrototypeOf(B)).

👍 And should be documented.

Done in #30