Include runtime types, otherwise ts goes crazy

mrazator/delta-based-sync
Marcel Mraz 4 months ago
parent d2fed34a30
commit 725c25c966
No known key found for this signature in database
GPG Key ID: 4EBD6E62DC830CD2

@ -83,6 +83,7 @@ export const AIComponents = ({
}
try {
// @ts-expect-error
const { html } = await response.json();
if (!html) {
@ -140,9 +141,11 @@ export const AIComponents = ({
};
}
// @ts-expect-error
throw new Error(json.message || "Generation failed...");
}
// @ts-expect-error
const generatedResponse = json.generatedResponse;
if (!generatedResponse) {
throw new Error("Generation failed...");

@ -309,19 +309,23 @@ export const exportToBackend = async (
body: payload.buffer,
});
const json = await response.json();
// @ts-expect-error
if (json.id) {
const url = new URL(window.location.href);
// We need to store the key (and less importantly the id) as hash instead
// of queryParam in order to never send it to the server
// @ts-expect-error
url.hash = `json=${json.id},${encryptionKey}`;
const urlString = url.toString();
await saveFilesToFirebase({
// @ts-expect-error
prefix: `/files/shareLinks/${json.id}`,
files: filesToUpload,
});
return { url: urlString, errorMessage: null };
// @ts-expect-error
} else if (json.error_class === "RequestTooLargeError") {
return {
url: null,

@ -304,6 +304,7 @@ const PublishLibrary = ({
.then(
(response) => {
if (response.ok) {
// @ts-expect-error
return response.json().then(({ url }) => {
// flush data from local storage
EditorLocalStorage.delete(EDITOR_LS_KEYS.PUBLISH_LIBRARY);
@ -321,6 +322,7 @@ const PublishLibrary = ({
})
.then((error) => {
throw new Error(
// @ts-expect-error
error.message || response.statusText || "something went wrong",
);
});

@ -30,7 +30,7 @@ export function useOutsideClick<T extends HTMLElement>(
return;
}
const isInsideOverride = isInside?.(_event, ref.current);
const isInsideOverride = isInside?.(_event as any, ref.current);
if (isInsideOverride === true) {
return;

@ -98,7 +98,7 @@
"@babel/preset-env": "7.24.5",
"@babel/preset-react": "7.24.1",
"@babel/preset-typescript": "7.24.1",
"@cloudflare/workers-types": "^4.20241112.0",
"@cloudflare/workers-types": "4.20241112.0",
"@size-limit/preset-big-lib": "9.0.0",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "5.16.2",
@ -142,6 +142,6 @@
"size": "yarn build:umd && size-limit",
"sync:deploy": "wrangler deploy",
"sync:dev": "wrangler dev",
"sync:typegen": "wrangler types"
"sync:typegen": "wrangler types --experimental-include-runtime=\"./worker-runtime.d.ts\""
}
}

@ -26,6 +26,7 @@ const polyfill = () => {
if (!Element.prototype.replaceChildren) {
Element.prototype.replaceChildren = function (...nodes) {
this.innerHTML = "";
// @ts-expect-error
this.append(...nodes);
};
}

@ -362,6 +362,7 @@ const renderElementToSvg = (
root.appendChild(g);
} else {
addToRoot(group, element);
// @ts-expect-error
root.append(maskPath);
}
break;

@ -25,8 +25,8 @@ const load = (): Promise<{
return new Promise(async (resolve, reject) => {
try {
const module = await WebAssembly.instantiate(binary);
// @ts-expect-error
const harfbuzzJsWasm = module.instance.exports;
// @ts-expect-error since `.buffer` is custom prop
const heapu8 = new Uint8Array(harfbuzzJsWasm.memory.buffer);
const hbSubset = {

@ -11,8 +11,5 @@
"moduleResolution": "Node",
"resolveJsonModule": true,
"jsx": "react-jsx",
"types": [
"@cloudflare/workers-types/2023-07-01"
],
}
}

@ -1,4 +1,4 @@
// Generated by Wrangler by running `wrangler types`
// Generated by Wrangler by running `wrangler types --experimental-include-runtime=./worker-runtime.d.ts`
interface Env {
DURABLE_ROOM: DurableObjectNamespace<

File diff suppressed because it is too large Load Diff

@ -14,7 +14,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
},
"include": ["packages", "excalidraw-app"],
"exclude": ["packages/excalidraw/types", "examples"]

@ -1539,7 +1539,7 @@
mime "^3.0.0"
zod "^3.22.3"
"@cloudflare/workers-types@^4.20241112.0":
"@cloudflare/workers-types@4.20241112.0":
version "4.20241112.0"
resolved "https://registry.yarnpkg.com/@cloudflare/workers-types/-/workers-types-4.20241112.0.tgz#174f8ccbfe1cc2e07b86622f82b84698f62d14c7"
integrity sha512-Q4p9bAWZrX14bSCKY9to19xl0KMU7nsO5sJ2cTVspHoypsjPUMeQCsjHjmsO2C4Myo8/LPeDvmqFmkyNAPPYZw==

Loading…
Cancel
Save