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

invalid type definition for RetryInterceptor #122

Open
reinholdk opened this issue Jan 28, 2019 · 3 comments
Open

invalid type definition for RetryInterceptor #122

reinholdk opened this issue Jan 28, 2019 · 3 comments

Comments

@reinholdk
Copy link

there seems to be an error in the type definition of RetryInterceptor

aurelia-fetch-client 1.8.0
typescript 3.2.4

https://github.com/aurelia/fetch-client/blob/fa53ec779f2e0937129010e952c57568842bd46b/dist/aurelia-fetch-client.d.ts#L310`

error TS2416: Property 'response' in type 'RetryInterceptor' is not assignable to the same property in base type 'Interceptor'.
  Type '(response: Response, request: Request) => Response' is not assignable to type '(response: Response, request?: Request | undefined) => Response | Promise<Response>'.
    Types of parameters 'request' and 'request' are incompatible.
      Type 'Request | undefined' is not assignable to type 'Request'.
        Type 'undefined' is not assignable to type 'Request'.
@evanlarsen
Copy link

I had the same issue so, I just edited the definition file myself. This isn't a lasting change but it will atleast let you build your project for now.

	export declare class RetryInterceptor implements Interceptor {
		retryConfig: RetryConfiguration;
		constructor(retryConfig?: RetryConfiguration);
		request(request: Request): Request;
		response(response: Response, request?: Request): Response;
		responseError(error: Response, request?: Request, httpClient?: HttpClient): Promise<Response>;
	}

@tareqimbasher
Copy link
Contributor

I did the something similar as a quick fix.

export declare class RetryInterceptor implements Interceptor {
    retryConfig: RetryConfiguration;
    constructor(retryConfig?: RetryConfiguration);
    request(request: Request): Request;
    response(response: Response, request?: Request): Response | Promise<Response>;
    responseError(error: Response, request?: Request, httpClient?: HttpClient): Response | Promise<Response>;
}

I would be happy to make the fix on the definition file and create a PR, but I'm not sure if it is being automatically generated. @EisenbergEffect If it is not auto-generated, please let me know and I will submit a PR.

@EisenbergEffect
Copy link
Contributor

EisenbergEffect commented Feb 1, 2019

We recently switch this repo over to using TS as its source language. So, the d.ts file is now generated directly from TS. I think a PR directly to the src folder to correct it there would be the way to go. Thanks for volunteering @tareqimbasher !

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

4 participants