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

fix(types): update interceptors type #476

merged 1 commit into from Feb 8, 2021

fix(types): update interceptors type #476

merged 1 commit into from Feb 8, 2021


Copy link

@farnabaz farnabaz commented Feb 3, 2021

Update return types of interceptor functions to match axios interceptor and module logic.
The interceptor implementation provide possibility to return config.

onRequest(fn) {
 this.interceptors.request.use(config => fn(config) || config)

Also Axios interceptors can support async callbacks. And reject handlers can return any type not just AxiosError

export interface AxiosInterceptorManager<V> {
  use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number;
  eject(id: number): void;

export interface AxiosInstance {
  interceptors: {
    request: AxiosInterceptorManager<AxiosRequestConfig>;
    response: AxiosInterceptorManager<AxiosResponse>;

resolves #441

Copy link

codecov bot commented Feb 3, 2021

Codecov Report

Merging #476 (9b4d043) into master (62f17ca) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #476   +/-   ##
  Coverage   88.23%   88.23%           
  Files           1        1           
  Lines          51       51           
  Branches       27       27           
  Hits           45       45           
  Misses          6        6           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62f17ca...18f02c3. Read the comment docs.

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

Successfully merging this pull request may close these issues.

Extended Axios.AxiosRequestConfig from #408 breaks interceptor types
2 participants