From ededd32521918ef5ed8fdfadf61c2f0c3de08f1e Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Tue, 16 Apr 2024 17:23:43 -0400 Subject: [PATCH] Fix more embed types. Ignore TS errors on code we're not keeping. --- src/api/session.js | 1 + src/api/viewer.js | 1 + src/lib/api/addons.ts | 10 ++++++---- .../documents/[id]/pages/[page]/+page.svelte | 5 ++++- .../(embed)/projects/[project_id]/+page.svelte | 15 ++++++++------- src/routes/app/sidebar/AddOns.svelte | 6 ++++-- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/api/session.js b/src/api/session.js index cf7e7837f..110cfeac6 100644 --- a/src/api/session.js +++ b/src/api/session.js @@ -86,6 +86,7 @@ export class SessionCache { const sessionCache = new SessionCache(); +// @ts-ignore session.getStatic = async function getStatic(url) { if (sessionCache.has(url)) { return sessionCache.lookup(url); diff --git a/src/api/viewer.js b/src/api/viewer.js index d83c2c1be..bd88b4b72 100644 --- a/src/api/viewer.js +++ b/src/api/viewer.js @@ -12,6 +12,7 @@ export function documentDimensionUrl(document) { function getDesiredSize(desiredWidth) { for (let i = 0; i < IMAGE_WIDTHS.length; i++) { const [width, name] = IMAGE_WIDTHS[i]; + // @ts-ignore if (desiredWidth <= width) return name; } return IMAGE_WIDTHS[IMAGE_WIDTHS.length - 1][1]; diff --git a/src/lib/api/addons.ts b/src/lib/api/addons.ts index 61ffddb2c..73ebb9a37 100644 --- a/src/lib/api/addons.ts +++ b/src/lib/api/addons.ts @@ -1,8 +1,10 @@ +import type { Page } from "@/api/types/common"; +import type { AddOnListItem } from "@/addons/types"; + import { error } from "@sveltejs/kit"; + import { BASE_API_URL } from "@/config/config.js"; -import { type AddOnListItem } from "@/addons/types"; import { isErrorCode } from "../utils"; -import type { Page } from "@/api/types/common"; export async function getPinnedAddons( fetch = globalThis.fetch, @@ -15,7 +17,7 @@ export async function getPinnedAddons( if (isErrorCode(resp.status)) { error(resp.status, resp.statusText); } - return resp.json(); + return resp.json() as Promise>; } export async function getAddons( @@ -26,5 +28,5 @@ export async function getAddons( if (isErrorCode(resp.status)) { error(resp.status, resp.statusText); } - return resp.json(); + return resp.json() as Promise>; } diff --git a/src/routes/(embed)/documents/[id]/pages/[page]/+page.svelte b/src/routes/(embed)/documents/[id]/pages/[page]/+page.svelte index 74e95e28e..f5a030ebd 100644 --- a/src/routes/(embed)/documents/[id]/pages/[page]/+page.svelte +++ b/src/routes/(embed)/documents/[id]/pages/[page]/+page.svelte @@ -1,4 +1,5 @@ -