Skip to content

Commit

Permalink
fix: literal union typing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Apr 19, 2020
1 parent 8bc86b4 commit d767a44
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/glaze/src/useStyling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { CSSProperties } from 'react';
import { useStyles } from 'react-treat';
import { ThemeOrAny } from 'treat/theme';
import { ValueOf } from 'type-fest';
import { LiteralUnion, ValueOf } from 'type-fest';

import { Tokens } from './theme';
import { useTheme } from './ThemeContext';
Expand All @@ -21,12 +21,15 @@ type ResolveAlias<
? ResolveShorthand<ThemeOrAny['aliases'][T]>
: ThemeOrAny['aliases'][T];

type ScaleKeys<Property> = Extract<
keyof ThemeOrAny['scales'][ThemeOrAny['matchers'][Extract<
Property,
Tokens<'matchers'>
>]],
ValueOf<CSSProperties>
type ScaleKeys<Property> = LiteralUnion<
Extract<
keyof ThemeOrAny['scales'][ThemeOrAny['matchers'][Extract<
Property,
Tokens<'matchers'>
>]],
ValueOf<CSSProperties>
>,
CSSProperties[keyof CSSProperties]
>;

export type ThemedStyle = CSSProperties &
Expand Down

0 comments on commit d767a44

Please sign in to comment.