ThemeContext: Fix useStyles return type (#26696)

Still returned `any` because the type of memoizedStyleCreator wasn't declared properly.
This commit is contained in:
Andreas Opferkuch 2020-07-30 16:03:44 +02:00 committed by GitHub
parent ba2524cd88
commit ed950842bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,7 +51,7 @@ export function useTheme(): GrafanaTheme {
export function useStyles<T>(getStyles: (theme: GrafanaTheme) => T) {
const theme = useTheme();
let memoizedStyleCreator = memoizedStyleCreators.get(getStyles);
let memoizedStyleCreator = memoizedStyleCreators.get(getStyles) as typeof getStyles;
if (!memoizedStyleCreator) {
memoizedStyleCreator = stylesFactory(getStyles);
memoizedStyleCreators.set(getStyles, memoizedStyleCreator);