From d74b2cfe889e28f852ec97ac0c0f1839ebd621d0 Mon Sep 17 00:00:00 2001 From: Christian Moen Date: Tue, 27 Aug 2024 08:25:17 +0200 Subject: [PATCH] Added type declaration for chakra MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a weird bug when you have moduleResolution set to bundler, causing modules that use a more direct import style to become unresolvable. The solution for this wasn’t obvious. The reason turned out to be related to our spor-react library, where we use Chakra’s forwardRef. The definition is specified to be within some dist folder in Chakra. I suppose there might be some tricks to work around this by importing it differently, but it has become too time-consuming to chase this any further, especially since we might switch to another component library later on. The problem doesn’t occur if you set moduleResolution to node. --- apps/docs/tsconfig.json | 8 +++++++- apps/docs/types.d.ts | 3 +++ package-lock.json | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 apps/docs/types.d.ts diff --git a/apps/docs/tsconfig.json b/apps/docs/tsconfig.json index fd6b625fa..c77787e1d 100644 --- a/apps/docs/tsconfig.json +++ b/apps/docs/tsconfig.json @@ -1,5 +1,11 @@ { - "include": ["env.d.ts", "**/*.ts", "**/*.tsx", "vite.config.mts"], + "include": [ + "env.d.ts", + "types.d.ts", + "**/*.ts", + "**/*.tsx", + "vite.config.mts" + ], "compilerOptions": { "lib": ["DOM", "DOM.Iterable", "ES2019"], "isolatedModules": true, diff --git a/apps/docs/types.d.ts b/apps/docs/types.d.ts new file mode 100644 index 000000000..f933baa9c --- /dev/null +++ b/apps/docs/types.d.ts @@ -0,0 +1,3 @@ +declare module "@chakra-ui/system/dist/system.types" { + export * from "@chakra-ui/react"; +} diff --git a/package-lock.json b/package-lock.json index f8e3f463e..a1d1fcea7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,7 +43,7 @@ "@vygruppen/spor-design-tokens": "^3.8.1", "@vygruppen/spor-icon": "^2.9.0", "@vygruppen/spor-icon-react": "^3.9.0", - "@vygruppen/spor-react": "^10.4.1", + "@vygruppen/spor-react": "^10.6.0", "archiver": "^5.3.2", "deepmerge": "^4.3.1", "framer-motion": "^8.5.5", @@ -32967,7 +32967,7 @@ }, "packages/spor-react": { "name": "@vygruppen/spor-react", - "version": "10.4.1", + "version": "10.6.0", "license": "MIT", "dependencies": { "@chakra-ui/react": "^2.8.2",