code: function bindMethod(
    target: DecoratorTarget,
    name: string,
    descriptor: Descriptor,
  ): Descriptor {
    const func = getValueFunc('bind', descriptor);
  
    return {
      configurable: true,
      enumerable: false,
      get() {
        // This happens if someone accesses the property directly on the prototype
        // Thanks to jayphelps/core-decorators.js for the snippet
        if (this === target) {
          return func;
        }
  
        // The `this` here is the current class prototype
        // While `target` is the parent class prototype
        const boundFunc = func.bind(this);
  
        // Define a function on the target so that `get()` is only called once
        // Inherit the original methods descriptor as well
        Object.defineProperty(this, name, {
          ...descriptor,
          enumerable: true,
          value: boundFunc,
        });
  
        return boundFunc;
      },
      set(value) {
        Object.defineProperty(this, name, {
          ...descriptor,
          value,
        });
      },
    };
  }
docs: Bind the context of a method to the executing objects `this` context.
  We must override the descriptor as `value()` doesn't use the correct `this` context.