/**
 * Stolen from [StackOverflow answer](https://stackoverflow.com/questions/46376468/how-to-get-type-of-array-items).
 */
export type ElementType<ContainerType extends Iterable<any>> =
  ContainerType extends Iterable<infer ElementType> ? ElementType : never;

export type StrictOmit<Type, Key extends keyof Type> = Omit<Type, Key>;

/**
 * Make selected keys optional.
 */
export type IPartialSome<Type, Key extends keyof Type> = Omit<Type, Key> &
  Pick<Partial<Type>, Key>;

/**
 * Make selected key required.
 */
export type IRequiredSome<Type, Key extends keyof Type> = Omit<Type, Key> &
  Pick<Required<Type>, Key>;
