File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ function _classNaming(
4242 const className = joinWithLead ( propagate , dehash ( classes ) )
4343 , host : ClassNamingCall = classes => _classNaming ( classes , className )
4444
45- return wrapper ( className , [ ] , host )
45+ return wrapper ( className , undefined , host )
4646}
4747
4848type ClassNamingChain = ClassNamingCall & {
Original file line number Diff line number Diff line change @@ -13,9 +13,14 @@ export {
1313 joinWithLead
1414}
1515
16- function wrapper < T > ( className : Falsy | ClassValue , classKeys : string [ ] , destination : T ) {
16+ function wrapper < T > (
17+ className : Parameters < typeof joinWithLead > [ 0 ] ,
18+ classKeys : Parameters < typeof joinWithLead > [ 1 ] ,
19+ destination : T
20+ ) {
1721 //@ts -expect-error
18- destination [ classNameKey ] = joinWithLead ( className , classKeys )
22+ destination [ classNameKey ]
23+ = joinWithLead ( className , classKeys )
1924
2025 return stringifyClassNamed ( destination as T & ClassNamed )
2126}
@@ -53,13 +58,13 @@ function truthyKeys<T>(source: T) {
5358 return filtered
5459}
5560
56- //TODO Consider undefined
57- function joinWithLead ( value : Falsy | ClassValue , arr : readonly string [ ] ) :string {
61+ //TODO Consider returning ` undefined` on empty string
62+ function joinWithLead ( value : Falsy | ClassValue , arr : undefined | readonly string [ ] ) : string {
5863 const str1 = value || ""
59- if ( ! arr . length )
64+ if ( ! ( arr && arr . length ) )
6065 return str1
6166
62- const str2 = arr . join ( " " )
67+ const str2 = arr . join ( " " )
6368 if ( ! str1 )
6469 return str2
6570
You can’t perform that action at this time.
0 commit comments