Skip to content

Commit f7d39d7

Browse files
committed
docs: update
1 parent 1ffcfc2 commit f7d39d7

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

docs/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
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

src/className.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { createStyled } from "./styled";
2020
import { CSSRuleObject, StyledObject, StyledOptions } from "./types";
2121
import { isStyledObject } from "./utils";
2222

23-
export type StyledClassName = (...args:string[])=>string
23+
export type StyledClassName = (...args:(string | undefined)[])=>string
2424

2525
export function className(styles:CSSRuleObject,options?:StyledOptions): StyledClassName
2626
export 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[])=>{

0 commit comments

Comments
 (0)