Skip to content

Commit

Permalink
Relay: improve types of 'handleData'
Browse files Browse the repository at this point in the history
This change improves some internal types in Relay reported by Jakub Ž. Internal type of `response.json()` is `Promise<any>` so I just removed the type completely. This change doesn't affect anyone since it's internal only.

Closes: https://gitlab.skypicker.com/incubator/universe/issues/458
  • Loading branch information
Martin Zlámal committed Mar 15, 2019
1 parent d11355d commit 874b30f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@kiwicom/fetch",
"private": false,
"license": "MIT",
"version": "2.2.2",
"version": "2.2.3",
"main": "src/fetchWithRetries.js",
"homepage": "https://github.com/kiwicom/fetch",
"description": "Production ready fetch function with advanced capabilities like retries with delay and request cancellation after timeout.",
Expand Down
4 changes: 2 additions & 2 deletions src/ResponseError.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @flow
// @flow strict-local

import setPrototypeOf from './setPrototypeOf';

/**
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types
*/
function ResponseError(response: Object, message?: string) {
function ResponseError(response: Response, message?: string) {
// property 'error.response' is unknown in Error (but that's fine, we are extending here)
// $FlowExpectedError: ^^
const instance = new Error(message);
Expand Down
2 changes: 1 addition & 1 deletion src/TimeoutError.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @flow
// @flow strict-local

import setPrototypeOf from './setPrototypeOf';

Expand Down
1 change: 1 addition & 0 deletions src/__tests__/ResponseError.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { ResponseError } from '../fetchWithRetries';

// $FlowExpectedError: incomplete Response object for testing purposes only
const fetchResponse = {
status: 403,
};
Expand Down
4 changes: 2 additions & 2 deletions src/fetchWithRetries.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @flow
// @flow strict-local

import { sprintf, warning } from '@kiwicom/js';

Expand All @@ -24,7 +24,7 @@ export { TimeoutError, ResponseError };
export default function fetchWithRetries(
uri: string,
initWithRetries?: ?InitWithRetries,
): Promise<any> {
): Promise<Response> {
const { fetchTimeout, retryDelays, ...init } = initWithRetries || {};
const _fetchTimeout = fetchTimeout != null ? fetchTimeout : DEFAULT_TIMEOUT;
const _retryDelays = retryDelays != null ? retryDelays : DEFAULT_RETRIES;
Expand Down

0 comments on commit 874b30f

Please sign in to comment.