From 328241e030697e7b4257f9ffcae825567d8aae57 Mon Sep 17 00:00:00 2001 From: Stephan Lagerwaard Date: Fri, 18 Oct 2024 14:24:01 +0200 Subject: [PATCH] Remove memoizeOne dependency --- packages/types/memoize-one.d.ts | 7 ------- packages/types/package.json | 3 +-- packages/types/src/schemas.ts | 8 +++++++- xtask/src/commands/schemas.rs | 8 +++++++- 4 files changed, 15 insertions(+), 11 deletions(-) delete mode 100644 packages/types/memoize-one.d.ts diff --git a/packages/types/memoize-one.d.ts b/packages/types/memoize-one.d.ts deleted file mode 100644 index 95f4e94a6..000000000 --- a/packages/types/memoize-one.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module "memoize-one" { - // biome-ignore lint/suspicious/noExplicitAny: allow override - export default function memoizeOne any>( - resultFn: T, - isEqual?: (newArgs: Parameters, lastArgs: Parameters) => boolean, - ): T; -} diff --git a/packages/types/package.json b/packages/types/package.json index edcaf4f90..e811dc113 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -15,7 +15,6 @@ "build": "tsc" }, "devDependencies": { - "zod": "^3.23.8", - "memoize-one": "^6.0.0" + "zod": "^3.23.8" } } diff --git a/packages/types/src/schemas.ts b/packages/types/src/schemas.ts index e402ff977..daaa458c4 100644 --- a/packages/types/src/schemas.ts +++ b/packages/types/src/schemas.ts @@ -7,7 +7,13 @@ // =========================================== // import { z } from "zod"; -import memoizeOne from "memoize-one"; + +// TODO: Polyfill memoizeOne for now, seems like this breaks our TypeScript setup +// See: https://github.com/alexreardon/memoize-one/issues/267 +// Couldn't get it to work reliably on both the CI and locally with custom module type definitions +function memoizeOne(schema: T) { + return schema; +} export const AppStateSchema = memoizeOne(() => z.object({ workspace: z.union([z.lazy(WorkspaceSchema), z.null()]) }), diff --git a/xtask/src/commands/schemas.rs b/xtask/src/commands/schemas.rs index c33dcfbf8..f9763092b 100644 --- a/xtask/src/commands/schemas.rs +++ b/xtask/src/commands/schemas.rs @@ -80,7 +80,13 @@ fn generate_zod_schemas(schemas: Vec) -> Result> { // =========================================== // import { z } from "zod"; -import memoizeOne from "memoize-one"; + +// TODO: Polyfill memoizeOne for now, seems like this breaks our TypeScript setup +// See: https://github.com/alexreardon/memoize-one/issues/267 +// Couldn't get it to work reliably on both the CI and locally with custom module type definitions +function memoizeOne(schema: T) { + return schema; +} "#, );