File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,14 @@ export function variantFactory(context: Context) {
5353 }
5454
5555 function View ( props : Props ) {
56- const nameOfCaseRaw = context . useUnit ( $case , config . useUnitConfig ) ;
56+ const nameOfCaseRaw = context . useUnit (
57+ $case as Store < string | boolean > ,
58+ config . useUnitConfig ,
59+ ) ;
5760 const nameOfCase = (
58- 'if' in config ? ifToVariant ( nameOfCaseRaw as any ) : nameOfCaseRaw
61+ typeof nameOfCaseRaw === 'string'
62+ ? nameOfCaseRaw
63+ : booleanToVariant ( nameOfCaseRaw as boolean )
5964 ) as Variant ;
6065 const Component = cases [ nameOfCase ] ?? def ;
6166
@@ -73,6 +78,6 @@ export function variantFactory(context: Context) {
7378 } ;
7479}
7580
76- function ifToVariant ( value : boolean ) : 'then' | 'else' {
81+ function booleanToVariant ( value : boolean ) : 'then' | 'else' {
7782 return value ? 'then' : 'else' ;
7883}
You can’t perform that action at this time.
0 commit comments