Commit ed950842 by Andreas Opferkuch Committed by GitHub

ThemeContext: Fix useStyles return type (#26696)

Still returned `any` because the type of memoizedStyleCreator wasn't declared properly.
parent ba2524cd
...@@ -51,7 +51,7 @@ export function useTheme(): GrafanaTheme { ...@@ -51,7 +51,7 @@ export function useTheme(): GrafanaTheme {
export function useStyles<T>(getStyles: (theme: GrafanaTheme) => T) { export function useStyles<T>(getStyles: (theme: GrafanaTheme) => T) {
const theme = useTheme(); const theme = useTheme();
let memoizedStyleCreator = memoizedStyleCreators.get(getStyles); let memoizedStyleCreator = memoizedStyleCreators.get(getStyles) as typeof getStyles;
if (!memoizedStyleCreator) { if (!memoizedStyleCreator) {
memoizedStyleCreator = stylesFactory(getStyles); memoizedStyleCreator = stylesFactory(getStyles);
memoizedStyleCreators.set(getStyles, memoizedStyleCreator); memoizedStyleCreators.set(getStyles, memoizedStyleCreator);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment