TypeScript compiler errors when not safeguarding GUI code
diff --git a/src/tribler/ui/src/pages/Downloads/index.tsx b/src/tribler/ui/src/pages/Downloads/index.tsx
index f24f000e8..de3ad9c1d 100644
--- a/src/tribler/ui/src/pages/Downloads/index.tsx
+++ b/src/tribler/ui/src/pages/Downloads/index.tsx
@@ -159,6 +159,7 @@ export default function Downloads({ statusFilter }: { statusFilter: number[] })
// Don't bother the user on error, just try again later.
const response = await triblerService.getDownloads(infohash, !!infohash, !!infohash);
+ console.log(response[0]);
if (response !== undefined && !isErrorDict(response)) {
setDownloads(response.filter((download: Download) => {
return statusFilter.includes(download.status_code);
>npm run build
> tribler-webui@0.1.0 build
> tsc && vite build
src/pages/Downloads/index.tsx:162:21 - error TS18048: 'response' is possibly 'undefined'.
162 console.log(response[0]);
~~~~~~~~
src/pages/Downloads/index.tsx:162:21 - error TS7053: Element implicitly has an 'any' type because expression of type '0' can't be used to index type 'ErrorDict | Download[]'.
Property '0' does not exist on type 'ErrorDict | Download[]'.
162 console.log(response[0]);
~~~~~~~~~~~
Found 2 errors in the same file, starting at: src/pages/Downloads/index.tsx:162
Fixes #8141
This PR:
Notes:
Expected core error status example
Unexpected core error status example
TypeScript error example
TypeScript compiler errors when not safeguarding GUI code