Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing AbortSignal interface used in index.d.ts #4304

Closed
vishalailani opened this issue Nov 30, 2021 · 5 comments
Closed

Missing AbortSignal interface used in index.d.ts #4304

vishalailani opened this issue Nov 30, 2021 · 5 comments

Comments

@vishalailani
Copy link

Describe the issue

AbortSignal interface is missing from index.d.ts. it is used indise interface AxiosRequestConfig.

Example Code

export interface AxiosRequestConfig<D = any> {
  url?: string;
  method?: Method;
  baseURL?: string;
  transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
  transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
  headers?: AxiosRequestHeaders;
  params?: any;
  paramsSerializer?: (params: any) => string;
  data?: D;
  timeout?: number;
  timeoutErrorMessage?: string;
  withCredentials?: boolean;
  adapter?: AxiosAdapter;
  auth?: AxiosBasicCredentials;
  responseType?: ResponseType;
  xsrfCookieName?: string;
  xsrfHeaderName?: string;
  onUploadProgress?: (progressEvent: any) => void;
  onDownloadProgress?: (progressEvent: any) => void;
  maxContentLength?: number;
  validateStatus?: ((status: number) => boolean) | null;
  maxBodyLength?: number;
  maxRedirects?: number;
  socketPath?: string | null;
  httpAgent?: any;
  httpsAgent?: any;
  proxy?: AxiosProxyConfig | false;
  cancelToken?: CancelToken;
  decompress?: boolean;
  transitional?: TransitionalOptions;
  signal?: AbortSignal;
  insecureHTTPParser?: boolean;
}

Expected behavior, if applicable

AbortSignal interface should be there

Environment

  • Axios Version [0.22.0]

Additional context/Screenshots

Screenshot 2021-11-30 at 7 51 59 PM

@DigitalBrainJS
Copy link
Collaborator

AbortSignal is a global interface for browsers and Node.js starting from v15.0.0. You need to import DOM.d.ts for client builds or node-abort-controller polyfill for node older than v15.0.0.
We already have #4229 PR with a hotfix for this.

@vishalailani
Copy link
Author

okay so i guess it will be merged in a day or two, right ?

@csnate
Copy link

csnate commented Dec 10, 2021

You can also try installing @types/node@15 (or greater) as a devDependency for node projects. Worked for me.

Does this mean axios@0.24.0 requires Node 15?

@alecgibson
Copy link

For anyone on Node.js v14, I've raised: DefinitelyTyped/DefinitelyTyped#58270

@jasonsaayman
Copy link
Member

Going to close as newer node versions fix this and older versions are almost deprecated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants