Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

tsc

Manav Rathi0a8f51832a21
diff --git a/web/apps/cast/src/pages/index.tsx b/web/apps/cast/src/pages/index.tsx
index 37fcf3d4be..2a993972bd 100644
--- a/web/apps/cast/src/pages/index.tsx
+++ b/web/apps/cast/src/pages/index.tsx
@@ -38,6 +38,8 @@ export default function Index() {
}, [publicKeyB64, privateKeyB64, pairingCode]);
const pollTick = async () => {
+ if (!publicKeyB64 || !privateKeyB64 || !pairingCode) return;
+
const registration = { publicKeyB64, privateKeyB64, pairingCode };
try {
const data = await getCastData(registration);
diff --git a/web/apps/cast/src/pages/slideshow.tsx b/web/apps/cast/src/pages/slideshow.tsx
index 326b183d4a..b5cff2f91e 100644
--- a/web/apps/cast/src/pages/slideshow.tsx
+++ b/web/apps/cast/src/pages/slideshow.tsx
@@ -50,7 +50,7 @@ export default function Slideshow() {
};
}, []);
- if (loading) return <PairingComplete />;
+ if (loading || !imageURL) return <PairingComplete />;
if (isEmpty) return <NoItems />;
return isChromecast() ? (
diff --git a/web/apps/cast/src/services/cast-data.ts b/web/apps/cast/src/services/cast-data.ts
index 587d1db323..b429eee72e 100644
--- a/web/apps/cast/src/services/cast-data.ts
+++ b/web/apps/cast/src/services/cast-data.ts
@@ -19,8 +19,8 @@ export const storeCastData = (payload: unknown) => {
// Iterate through all the keys of the payload object and save them to
// localStorage. We don't validate here, we'll validate when we read these
// values back in `readCastData`.
- for (const key in payload) {
- window.localStorage.setItem(key, payload[key]);
+ for (const [key, value] of Object.entries(payload)) {
+ window.localStorage.setItem(key, value);
}
};
diff --git a/web/apps/cast/src/services/chromecast.ts b/web/apps/cast/src/services/chromecast.ts
index e7539e8c51..77aa54aec1 100644
--- a/web/apps/cast/src/services/chromecast.ts
+++ b/web/apps/cast/src/services/chromecast.ts
@@ -141,6 +141,7 @@ const advertiseCode = (cast: Cast) => {
const collectionID =
data &&
typeof data == "object" &&
+ "collectionID" in data &&
typeof data["collectionID"] == "string"
? data["collectionID"]
: undefined;
diff --git a/web/apps/cast/src/services/detect-type.ts b/web/apps/cast/src/services/detect-type.ts
index c43529aaed..bbee910290 100644
--- a/web/apps/cast/src/services/detect-type.ts
+++ b/web/apps/cast/src/services/detect-type.ts
@@ -13,7 +13,7 @@ import FileType from "file-type";
* For the list of returned extensions, see (for our installed version):
* https://github.com/sindresorhus/file-type/blob/main/core.d.ts
*/
-export const detectMediaMIMEType = async (file: File): Promise<string> => {
+export const detectMediaMIMEType = async (file: File) => {
const chunkSizeForTypeDetection = 4100;
const fileChunk = file.slice(0, chunkSizeForTypeDetection);
const chunk = new Uint8Array(await fileChunk.arrayBuffer());
diff --git a/web/apps/cast/src/services/render.ts b/web/apps/cast/src/services/render.ts
index 47e983ab1d..e56ce1774f 100644
--- a/web/apps/cast/src/services/render.ts
+++ b/web/apps/cast/src/services/render.ts
@@ -15,7 +15,7 @@ import { apiOrigin, customAPIOrigin } from "@ente/shared/network/api";
import type { AxiosResponse } from "axios";
import type { CastData } from "services/cast-data";
import { detectMediaMIMEType } from "services/detect-type";
-import {
+import type {
EncryptedEnteFile,
EnteFile,
FileMagicMetadata,
diff --git a/web/apps/cast/src/types/file/index.ts b/web/apps/cast/src/types/file/index.ts
index c21f04a0ab..f294a54a18 100644
--- a/web/apps/cast/src/types/file/index.ts
+++ b/web/apps/cast/src/types/file/index.ts
@@ -1,5 +1,5 @@
import type { Metadata } from "@/media/types/file";
-import {
+import type {
EncryptedMagicMetadata,
MagicMetadataCore,
VISIBILITY_STATE,
diff --git a/web/apps/cast/tsconfig.json b/web/apps/cast/tsconfig.json
index cbdd32f742..bbe7217aad 100644
--- a/web/apps/cast/tsconfig.json
+++ b/web/apps/cast/tsconfig.json
@@ -1,25 +1,17 @@
{
- "extends": "../../tsconfig.base.json",
+ "extends": "@/build-config/tsconfig-next.json",
"compilerOptions": {
+ /* Set the base directory from which to resolve bare module names */
"baseUrl": "./src",
- "downlevelIteration": true,
- "jsx": "preserve",
- "jsxImportSource": "@emotion/react",
- "lib": ["dom", "dom.iterable", "esnext", "webworker"],
- "noImplicitAny": false,
- "noUnusedLocals": false,
- "noUnusedParameters": false,
- "strictNullChecks": false,
- "target": "es5",
- "useUnknownInCatchVariables": false
+
+ /* TODO(MR): Enable this */
+ "noUncheckedIndexedAccess": false,
+ /* MUI doesn't play great with exactOptionalPropertyTypes currently. */
+ "exactOptionalPropertyTypes": false
},
"include": [
- "next-env.d.ts",
- "**/*.ts",
- "**/*.tsx",
- "**/*.js",
- "../../packages/shared/themes/mui-theme.d.ts",
- "../../packages/accounts/**/*.tsx"
- ],
- "exclude": ["node_modules", "out", ".next", "thirdparty"]
+ "src",
+ "../../packages/next/global-electron.d.ts",
+ "../../packages/shared/themes/mui-theme.d.ts"
+ ]
}