File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
packages/build/src/homebrew Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff 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 > ;
4247export 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' ) {
You can’t perform that action at this time.
0 commit comments