mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Include runtime types, otherwise ts goes crazy
This commit is contained in:
parent
d2fed34a30
commit
725c25c966
13 changed files with 4709 additions and 10 deletions
|
@ -83,6 +83,7 @@ export const AIComponents = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// @ts-expect-error
|
||||||
const { html } = await response.json();
|
const { html } = await response.json();
|
||||||
|
|
||||||
if (!html) {
|
if (!html) {
|
||||||
|
@ -140,9 +141,11 @@ export const AIComponents = ({
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
throw new Error(json.message || "Generation failed...");
|
throw new Error(json.message || "Generation failed...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
const generatedResponse = json.generatedResponse;
|
const generatedResponse = json.generatedResponse;
|
||||||
if (!generatedResponse) {
|
if (!generatedResponse) {
|
||||||
throw new Error("Generation failed...");
|
throw new Error("Generation failed...");
|
||||||
|
|
|
@ -309,19 +309,23 @@ export const exportToBackend = async (
|
||||||
body: payload.buffer,
|
body: payload.buffer,
|
||||||
});
|
});
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
// @ts-expect-error
|
||||||
if (json.id) {
|
if (json.id) {
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
// We need to store the key (and less importantly the id) as hash instead
|
// 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
|
// of queryParam in order to never send it to the server
|
||||||
|
// @ts-expect-error
|
||||||
url.hash = `json=${json.id},${encryptionKey}`;
|
url.hash = `json=${json.id},${encryptionKey}`;
|
||||||
const urlString = url.toString();
|
const urlString = url.toString();
|
||||||
|
|
||||||
await saveFilesToFirebase({
|
await saveFilesToFirebase({
|
||||||
|
// @ts-expect-error
|
||||||
prefix: `/files/shareLinks/${json.id}`,
|
prefix: `/files/shareLinks/${json.id}`,
|
||||||
files: filesToUpload,
|
files: filesToUpload,
|
||||||
});
|
});
|
||||||
|
|
||||||
return { url: urlString, errorMessage: null };
|
return { url: urlString, errorMessage: null };
|
||||||
|
// @ts-expect-error
|
||||||
} else if (json.error_class === "RequestTooLargeError") {
|
} else if (json.error_class === "RequestTooLargeError") {
|
||||||
return {
|
return {
|
||||||
url: null,
|
url: null,
|
||||||
|
|
|
@ -304,6 +304,7 @@ const PublishLibrary = ({
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
|
// @ts-expect-error
|
||||||
return response.json().then(({ url }) => {
|
return response.json().then(({ url }) => {
|
||||||
// flush data from local storage
|
// flush data from local storage
|
||||||
EditorLocalStorage.delete(EDITOR_LS_KEYS.PUBLISH_LIBRARY);
|
EditorLocalStorage.delete(EDITOR_LS_KEYS.PUBLISH_LIBRARY);
|
||||||
|
@ -321,6 +322,7 @@ const PublishLibrary = ({
|
||||||
})
|
})
|
||||||
.then((error) => {
|
.then((error) => {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
// @ts-expect-error
|
||||||
error.message || response.statusText || "something went wrong",
|
error.message || response.statusText || "something went wrong",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,7 +30,7 @@ export function useOutsideClick<T extends HTMLElement>(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isInsideOverride = isInside?.(_event, ref.current);
|
const isInsideOverride = isInside?.(_event as any, ref.current);
|
||||||
|
|
||||||
if (isInsideOverride === true) {
|
if (isInsideOverride === true) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
"@babel/preset-env": "7.24.5",
|
"@babel/preset-env": "7.24.5",
|
||||||
"@babel/preset-react": "7.24.1",
|
"@babel/preset-react": "7.24.1",
|
||||||
"@babel/preset-typescript": "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",
|
"@size-limit/preset-big-lib": "9.0.0",
|
||||||
"@testing-library/dom": "10.4.0",
|
"@testing-library/dom": "10.4.0",
|
||||||
"@testing-library/jest-dom": "5.16.2",
|
"@testing-library/jest-dom": "5.16.2",
|
||||||
|
@ -142,6 +142,6 @@
|
||||||
"size": "yarn build:umd && size-limit",
|
"size": "yarn build:umd && size-limit",
|
||||||
"sync:deploy": "wrangler deploy",
|
"sync:deploy": "wrangler deploy",
|
||||||
"sync:dev": "wrangler dev",
|
"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) {
|
if (!Element.prototype.replaceChildren) {
|
||||||
Element.prototype.replaceChildren = function (...nodes) {
|
Element.prototype.replaceChildren = function (...nodes) {
|
||||||
this.innerHTML = "";
|
this.innerHTML = "";
|
||||||
|
// @ts-expect-error
|
||||||
this.append(...nodes);
|
this.append(...nodes);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,6 +362,7 @@ const renderElementToSvg = (
|
||||||
root.appendChild(g);
|
root.appendChild(g);
|
||||||
} else {
|
} else {
|
||||||
addToRoot(group, element);
|
addToRoot(group, element);
|
||||||
|
// @ts-expect-error
|
||||||
root.append(maskPath);
|
root.append(maskPath);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,8 +25,8 @@ const load = (): Promise<{
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const module = await WebAssembly.instantiate(binary);
|
const module = await WebAssembly.instantiate(binary);
|
||||||
|
// @ts-expect-error
|
||||||
const harfbuzzJsWasm = module.instance.exports;
|
const harfbuzzJsWasm = module.instance.exports;
|
||||||
// @ts-expect-error since `.buffer` is custom prop
|
|
||||||
const heapu8 = new Uint8Array(harfbuzzJsWasm.memory.buffer);
|
const heapu8 = new Uint8Array(harfbuzzJsWasm.memory.buffer);
|
||||||
|
|
||||||
const hbSubset = {
|
const hbSubset = {
|
||||||
|
|
|
@ -11,8 +11,5 @@
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"jsx": "react-jsx",
|
"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 {
|
interface Env {
|
||||||
DURABLE_ROOM: DurableObjectNamespace<
|
DURABLE_ROOM: DurableObjectNamespace<
|
||||||
|
|
4691
packages/excalidraw/worker-runtime.d.ts
vendored
Normal file
4691
packages/excalidraw/worker-runtime.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,7 @@
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx"
|
"jsx": "react-jsx",
|
||||||
},
|
},
|
||||||
"include": ["packages", "excalidraw-app"],
|
"include": ["packages", "excalidraw-app"],
|
||||||
"exclude": ["packages/excalidraw/types", "examples"]
|
"exclude": ["packages/excalidraw/types", "examples"]
|
||||||
|
|
|
@ -1539,7 +1539,7 @@
|
||||||
mime "^3.0.0"
|
mime "^3.0.0"
|
||||||
zod "^3.22.3"
|
zod "^3.22.3"
|
||||||
|
|
||||||
"@cloudflare/workers-types@^4.20241112.0":
|
"@cloudflare/workers-types@4.20241112.0":
|
||||||
version "4.20241112.0"
|
version "4.20241112.0"
|
||||||
resolved "https://registry.yarnpkg.com/@cloudflare/workers-types/-/workers-types-4.20241112.0.tgz#174f8ccbfe1cc2e07b86622f82b84698f62d14c7"
|
resolved "https://registry.yarnpkg.com/@cloudflare/workers-types/-/workers-types-4.20241112.0.tgz#174f8ccbfe1cc2e07b86622f82b84698f62d14c7"
|
||||||
integrity sha512-Q4p9bAWZrX14bSCKY9to19xl0KMU7nsO5sJ2cTVspHoypsjPUMeQCsjHjmsO2C4Myo8/LPeDvmqFmkyNAPPYZw==
|
integrity sha512-Q4p9bAWZrX14bSCKY9to19xl0KMU7nsO5sJ2cTVspHoypsjPUMeQCsjHjmsO2C4Myo8/LPeDvmqFmkyNAPPYZw==
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue