Skip to content

Commit

Permalink
fix: typing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Bodin committed Sep 24, 2021
1 parent bf17d5e commit 8afa9a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"test": "jest",
"lint": "eslint src/**/*",
"semantic-release": "semantic-release",
"compile": "ncc build ./dist/index.js -o ./build"
"compile": "ncc build ./dist/index.js -o ./build",
"hot:runtime": "tsc -b -w --preserveWatchOutput"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions src/crawler-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
UrlTestResponseBody,
} from './types/publicApiJsonResponses';

type SearchParams = { [key: string]: string | number | boolean };
type SearchParams = { [key: string]: boolean | number | string };

export interface ClientParams {
crawlerUserId: string;
Expand Down Expand Up @@ -81,7 +81,7 @@ class CrawlerApiClient {

static async __handleResponse<TBody>(res: Response): Promise<TBody> {
if (res.ok) {
return await res.json();
return (await res.json()) as TBody;
}
const error = await res.json();
throw new Error(
Expand Down Expand Up @@ -342,7 +342,7 @@ class CrawlerApiClient {
},
}
);
const { pending } = await res.json();
const { pending } = (await res.json()) as any;
if (pending) {
// console.log(`Task ${taskId} is pending, waiting...`);
await new Promise((resolve) => {
Expand Down Expand Up @@ -379,7 +379,7 @@ class CrawlerApiClient {
body: JSON.stringify({ url, config }),
}
);
return await res.json();
return (await res.json()) as UrlTestResponseBody;
}
}

Expand Down

0 comments on commit 8afa9a0

Please sign in to comment.