Skip to content

Conversation

@Mr-KRAMA
Copy link

When using chakra typegen --outdir ./custom-path, the generated TypeScript files contain broken relative imports that don't work outside the default location:

// Generated files have these broken imports:
import type { CssProperties } from "../css.types" // ❌ File doesn't exist
import type { ConditionalValue } from "../css.types" // ❌ File doesn't exist
import type { RecipeDefinition } from "../recipe.types" // ❌ File doesn't exist

Copy
typescript
This makes the --outdir flag essentially unusable for custom type generation.

Solution

Changed the CLI to generate absolute imports from @chakra-ui/react instead of relative paths:

// Now generates working imports:
import type { CssProperties, ConditionalValue, RecipeDefinition } from "@chakra-ui/react" // ✅ Works everywhere

Copy
typescript
Changes

Updated type generation functions to use absolute imports

Exported missing CssProperties type from @chakra-ui/react

Maintains backward compatibility - default behavior unchanged

Testing

This now works without TypeScript errors:

chakra typegen ./my-theme.ts --outdir ./anywhere

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

🦋 Changeset detected

Latest commit: 19fd799

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@chakra-ui/cli Patch
@chakra-ui/react Patch
@chakra-ui/panda-preset Patch
@chakra-ui/charts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
chakra-ui-storybook Ready Ready Preview Dec 3, 2025 10:01am
chakra-v3-docs Ready Ready Preview Dec 3, 2025 10:01am

@Mr-KRAMA
Copy link
Author

Branch updated and ready for review. All changesets are included.
The only blocker now is the pending workflow approval for external contributors.

Could a maintainer please approve the workflow and review the PR when possible?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant