/* tslint:disable:no-any */
import { SimpleChange as NgSimpleChanges } from '@angular/core';

declare type KgSafeAny = any;

// https://github.com/angular/angular/issues/17560#issuecomment-624161007
type SimpleChange<T> = Omit<NgSimpleChanges, 'previousValue' | 'currentValue'> & {
  previousValue: T;
  currentValue: T;
};

type SimpleChanges<T> = {
  [K in keyof T]: SimpleChange<T[K]>;
};

// https://gist.github.com/staltz/368866ea6b8a167fbdac58cddf79c1bf
type Pick2<T, K1 extends keyof T, K2 extends keyof T[K1]> = {
  [P1 in K1]: {
    [P2 in K2]: T[K1][P2];
  };
};
type Pick3<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]> = {
  [P1 in K1]: {
    [P2 in K2]: {
      [P3 in K3]: T[K1][K2][P3];
    };
  };
};

export { SimpleChange, SimpleChanges, KgSafeAny, Pick2, Pick3 };
