Skip to content

Commit

Permalink
fix: bring back Theme TS type export
Browse files Browse the repository at this point in the history
  • Loading branch information
TimKolberger committed Feb 11, 2021
1 parent e8113d3 commit d6808f0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-knives-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chakra-ui/theme": patch
---

Bring back the TS type `Theme` export and deprecated `DefaultChakraTheme`.
12 changes: 8 additions & 4 deletions packages/theme/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import components from "./components"
import foundations from "./foundations"
import styles from "./styles"
import { ChakraTheme, ThemeConfig, ThemeDirection } from "./theme.types"
import { ThemeConfig, ThemeDirection } from "./theme.types"

const direction = "ltr" as ThemeDirection

Expand All @@ -10,17 +10,21 @@ const config: ThemeConfig = {
initialColorMode: "light",
}

const defaultTheme = {
export const theme = {
direction,
...foundations,
components,
styles,
config,
}

export const theme: ChakraTheme = defaultTheme
export type Theme = typeof theme

export type DefaultChakraTheme = typeof defaultTheme
/**
* @deprecated
* Duplicate theme type. Please use `Theme`
*/
export type DefaultChakraTheme = Theme

export * from "./theme.types"

Expand Down
9 changes: 9 additions & 0 deletions packages/theme/tests/theme.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import theme, { ChakraTheme } from "../src"

describe("Theme", () => {
it("should be a ChakraTheme", () => {
// Check if default theme is of type ChakraTheme
const defaultThemeIsAChakraTheme: ChakraTheme = theme
expect(defaultThemeIsAChakraTheme).toBeTruthy()
})
})

0 comments on commit d6808f0

Please sign in to comment.