Skip to content

Commit 8946ccb

Browse files
quantizorEvan Jacobs
andauthored
fix(styled-components): reimplement useTheme type wrapper (#421)
Co-authored-by: Evan Jacobs <ejacobs@aurorasolar.com>
1 parent 2ec83ed commit 8946ccb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/styled-components/src/theme.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { createUseGetter } from '@xstyled/core'
2-
import { th } from '@xstyled/system'
3-
import { useTheme } from 'styled-components'
2+
import { th, Theme } from '@xstyled/system'
3+
import { useTheme as useScTheme } from 'styled-components'
44

5-
export { useTheme }
5+
/**
6+
* Passthrough to styled-components `useTheme`, but returning the xstyled `Theme` type.
7+
*/
8+
export function useTheme(): Theme {
9+
return useScTheme()
10+
}
611

712
export const useTh = createUseGetter(th, useTheme)
813

0 commit comments

Comments
 (0)