Skip to content

Commit 17d2731

Browse files
even less hacky typecast
1 parent 51d83ef commit 17d2731

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/core/variant.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ export function variantFactory(context: Context) {
3232
useUnitConfig?: UseUnitConifg;
3333
},
3434
): (p: Props) => React.ReactNode {
35-
let $case: Store<Variant>;
35+
let $case: Store<Variant | boolean>;
3636
let cases: Record<Variant, View<Props>>;
3737
let def: View<Props>;
3838

3939
// Shortcut for Store<boolean>
4040
if ('if' in config) {
41-
$case = config.if as any;
41+
$case = config.if;
4242
cases = {
4343
then: config.then,
4444
else: config.else,
@@ -53,10 +53,7 @@ export function variantFactory(context: Context) {
5353
}
5454

5555
function View(props: Props) {
56-
const nameOfCaseRaw = context.useUnit(
57-
$case as Store<string | boolean>,
58-
config.useUnitConfig,
59-
);
56+
const nameOfCaseRaw = context.useUnit($case, config.useUnitConfig);
6057
const nameOfCase = (
6158
typeof nameOfCaseRaw === 'string'
6259
? nameOfCaseRaw

0 commit comments

Comments
 (0)