Skip to content

Commit

Permalink
Added type declaration for chakra
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Cmoen11 committed Aug 27, 2024
1 parent aed3a38 commit d74b2cf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 3 additions & 0 deletions apps/docs/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module "@chakra-ui/system/dist/system.types" {
export * from "@chakra-ui/react";
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d74b2cf

Please sign in to comment.