message: refactor: Make sure we are properly creating the AjaxError class
diff: /** @prettier */
  import { AjaxRequest } from './types';
  import { getXHRResponse } from './getXHRResponse';
  -
  -export type AjaxErrorNames = 'AjaxError' | 'AjaxTimeoutError';
  +import { createErrorClass } from '../util/createErrorClass';
  /**
  * A normalized AJAX error.
  @@ -46,9 +45,18 @@ export interface AjaxErrorCtor {
  new (message: string, xhr: XMLHttpRequest, request: AjaxRequest): AjaxError;
  }
  -const AjaxErrorImpl = (() => {
  - function AjaxErrorImpl(this: any, message: string, xhr: XMLHttpRequest, request: AjaxRequest): AjaxError {
  - Error.call(this);
  +/**
  + * Thrown when an error occurs during an AJAX request.
  + * This is only exported because it is useful for checking to see if an error
  + * is an `instanceof AjaxError`. DO NOT create new instances of `AjaxError` with
  + * the constructor.
  + *
  + * @class AjaxError
  + * @see ajax
  + */
  +export const AjaxError: AjaxErrorCtor = createErrorClass(
  + (_super) =>
  + function AjaxError(this: any, message: string, xhr: XMLHttpRequest, request: AjaxRequest) {
  this.message = message;
  this.name = 'AjaxError';
  this.xhr = xhr;
  @@ -64,22 +72,8 @@ const AjaxErrorImpl = (() => {
  response = xhr.responseText;
  }
  this.response = response;
  - return this;
  }
  - AjaxErrorImpl.prototype = Object.create(Error.prototype);
  - return AjaxErrorImpl;
  -})();
  -
  -/**
  - * Thrown when an error occurs during an AJAX request.
  - * This is only exported because it is useful for checking to see if an error
  - * is an `instanceof AjaxError`. DO NOT create new instances of `AjaxError` with
  - * the constructor.
  - *
  - * @class AjaxError
  - * @see ajax
  - */
  -export const AjaxError: AjaxErrorCtor = AjaxErrorImpl as any;
  +);
  export interface AjaxTimeoutError extends AjaxError {}
  