File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
1
# flexstyled
2
2
3
+ ## 2.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 0d5b3c6: [ 特性] : 更新` StyledClassName ` 的入参类型,从` string[] ` 变更为` (string | undefined)[] ` 提高容错性
8
+
3
9
## 2.0.7
4
10
5
11
### Patch Changes
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import { createStyled } from "./styled";
20
20
import { CSSRuleObject , StyledObject , StyledOptions } from "./types" ;
21
21
import { isStyledObject } from "./utils" ;
22
22
23
- export type StyledClassName = ( ...args :string [ ] ) => string
23
+ export type StyledClassName = ( ...args :( string | undefined ) [ ] ) => string
24
24
25
25
export function className ( styles :CSSRuleObject , options ?:StyledOptions ) : StyledClassName
26
26
export function className ( styles :CSSRuleObject , combindStyles ?:( StyledObject | StyledClassName ) [ ] , options ?:StyledOptions ) :StyledClassName
@@ -31,11 +31,11 @@ export function className(){
31
31
typeof ( arguments [ 1 ] ) == 'object' ? arguments [ 1 ] : Object . assign ( { } , arguments [ 2 ] )
32
32
) : { }
33
33
const combindClasss = ( combindStyles || [ ] ) . map ( item => {
34
- if ( typeof item === "function" ) {
35
- return item ( )
36
- } else if ( isStyledObject ( item ) ) {
37
- return item . className
38
- }
34
+ try {
35
+ return typeof item === "function" ? item ( ) : ( isStyledObject ( item ) ? item . className : '' )
36
+ } catch {
37
+ return ''
38
+ }
39
39
} ) . join ( " " )
40
40
const styleObject = createStyled ( styles , options )
41
41
return ( ...args :string [ ] ) => {
You can’t perform that action at this time.
0 commit comments