if (typeof Promise.withResolvers !== 'function') {
  Promise.withResolvers = function <T>() {
    let resolve!: (value: T | PromiseLike<T>) => void;
    let reject!: (reason?: any) => void;

    const promise = new Promise<T>((res, rej) => {
      resolve = res;
      reject = rej;
    });

    return { promise, resolve, reject };
  };
}

if (typeof Array.prototype.at !== 'function') {
  Array.prototype.at = function (index: number) {
    return index < 0 ? this[this.length + index] : this[index];
  };
}

export {};
