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 11# flexstyled
22
3+ ## 2.0.8
4+
5+ ### Patch Changes
6+
7+ - 0d5b3c6: [ 特性] : 更新` StyledClassName ` 的入参类型,从` string[] ` 变更为` (string | undefined)[] ` 提高容错性
8+
39## 2.0.7
410
511### Patch Changes
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import { createStyled } from "./styled";
2020import { CSSRuleObject , StyledObject , StyledOptions } from "./types" ;
2121import { isStyledObject } from "./utils" ;
2222
23- export type StyledClassName = ( ...args :string [ ] ) => string
23+ export type StyledClassName = ( ...args :( string | undefined ) [ ] ) => string
2424
2525export function className ( styles :CSSRuleObject , options ?:StyledOptions ) : StyledClassName
2626export function className ( styles :CSSRuleObject , combindStyles ?:( StyledObject | StyledClassName ) [ ] , options ?:StyledOptions ) :StyledClassName
@@ -31,11 +31,11 @@ export function className(){
3131 typeof ( arguments [ 1 ] ) == 'object' ? arguments [ 1 ] : Object . assign ( { } , arguments [ 2 ] )
3232 ) : { }
3333 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+ }
3939 } ) . join ( " " )
4040 const styleObject = createStyled ( styles , options )
4141 return ( ...args :string [ ] ) => {
You can’t perform that action at this time.
0 commit comments