Skip to content

Commit 4e82f57

Browse files
committed
style: Fix type-linter warnings
Dependency "node-fetch" has been hoisted and therefore now takes presendence over the "@types/node-fetch" dependency referenced by make-fetch-happen. The new types exposed through that are not compatible with make-fetch-happen and therefore required some adjustments. Also see DefinitelyTyped/DefinitelyTyped#59314 (comment)
1 parent 2c892ef commit 4e82f57

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

scripts/docs/downloadHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {pipeline} from "node:stream/promises";
66

77
export async function downloadFile(url: string, targetDir: string) {
88
const response = await fetch(url);
9-
if (!response.ok) {
9+
if (!response.ok || !response.body) {
1010
if (response.status === 404) {
1111
throw new Error(`The requested version does not exist`);
1212
} else {

src/tools/create_ui5_app/ODataMetadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default class ODataMetadata {
114114
try {
115115
this.serviceUrl = new URL(serviceUrl);
116116
const url = `${this.serviceUrl.toString()}$metadata`;
117-
const response = await fetch(url, {signal: AbortSignal.timeout(10000)} as fetch.FetchOptions);
117+
const response = await fetch(url, {signal: AbortSignal.timeout(10000)} as unknown as fetch.FetchOptions);
118118
if (!response.ok) {
119119
if (response.status === 404) {
120120
log.info(`The requested resource does not exist: ${url}`);

src/tools/get_api_reference/lib/apiReferenceResources.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export async function _createApiIndex(targetDir: string, apiJsonPaths: string[])
143143
export async function _fetchApiJson(targetPath: string, url: string) {
144144
const response = await fetchCdnRaw(url);
145145
await pipeline(
146-
response.body,
146+
response.body!,
147147
createWriteStream(targetPath)
148148
);
149149
return targetPath;

src/utils/cdnHelper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function fetchCdnRaw(url: string) {
3232
try {
3333
const response = await fetch(url);
3434

35-
if (!response.ok) {
35+
if (!response.ok || !response.body) {
3636
if (response.status === 404) {
3737
throw new Error(`The requested resource does not exist`);
3838
} else {
@@ -53,5 +53,5 @@ export async function fetchCdnRaw(url: string) {
5353

5454
export async function fetchCdn(url: string): Promise<object> {
5555
const res = await fetchCdnRaw(url);
56-
return await res.json() as unknown as object;
56+
return await res.json() as object;
5757
}

0 commit comments

Comments
 (0)