Skip to content

Commit 4e80cf7

Browse files
nirinchevgagik
andauthored
Apply suggestions from code review
Co-authored-by: Gagik Amaryan <[email protected]>
1 parent f513b10 commit 4e80cf7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/build/src/homebrew/utils.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ export async function npmPackageSha256(
55
packageUrl: string,
66
httpGetFn: typeof httpGet = httpGet
77
): Promise<string> {
8-
const json = await httpGetFn(packageUrl, 'json');
8+
const json = await httpGetFn<{
9+
dist: {
10+
tarball: string;
11+
shasum: string;
12+
}
13+
}>(packageUrl, 'json');
914
const tarballUrl = json.dist.tarball;
1015
const shasum = json.dist.shasum;
1116

@@ -38,13 +43,12 @@ async function getTarballWithRetries(
3843
}
3944
}
4045

41-
export function httpGet(url: string, response: 'json'): Promise<any>;
46+
export function httpGet<T>(url: string, response: 'json'): Promise<T>;
4247
export function httpGet(url: string, response: 'binary'): Promise<Buffer>;
43-
44-
export async function httpGet(
48+
export async function httpGet<T>(
4549
url: string,
4650
responseType: 'json' | 'binary'
47-
): Promise<any | Buffer> {
51+
): Promise<T | Buffer> {
4852
const response = await new Promise<string | Buffer[]>((resolve, reject) => {
4953
https.get(url, (stream) => {
5054
if (responseType === 'json') {

0 commit comments

Comments
 (0)