Skip to content

Commit d7ccb77

Browse files
committed
🏷️ Improve component types
1 parent 4638ed1 commit d7ccb77

File tree

8 files changed

+22
-11
lines changed

8 files changed

+22
-11
lines changed

src/components/Breadcrumb/breadcrumb.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import type { ButtonProps } from '../Button/button'
2+
13
export type BreadcrumbProps = {
24
items: {
35
icon?: string
46
label?: string
57
href?: string
6-
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop'
8+
target?: ButtonProps['target']
79
}[]
810
separator?: string
911
className?: string

src/components/Button/button.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ export type ButtonProps = {
88
| 'alert'
99
| null
1010
href?: string
11+
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop' | undefined
1112
className?: string
1213
[key: string]: any
1314
}
1415

1516
export type SvelteButtonProps = {
16-
onClick?: (() => any) | null
17+
onClick?: ((event: MouseEvent) => void) | null
1718
} & ButtonProps
1819

1920
export type ReactButtonProps = {
20-
onClick?: (() => any) | null
21+
onClick?: (event: React.MouseEvent) => void
2122
children: React.ReactNode
2223
} & ButtonProps

src/components/Checkbox/checkbox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ export type CheckboxProps = {
88
}
99

1010
export type SvelteCheckboxProps = {
11-
onClick?: (key: any) => any
11+
onClick?: ((event: MouseEvent) => void) | null
1212
} & CheckboxProps
1313

1414
export type ReactCheckboxProps = {
15-
onClick?: (key: any) => any
15+
onClick?: (event: React.MouseEvent) => void
1616
} & CheckboxProps

src/components/Footer/footer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ButtonProps } from '../Button/button'
2+
13
export type FooterProps = {
24
logo?: {
35
url?: string
@@ -12,7 +14,7 @@ export type FooterProps = {
1214
items: {
1315
href: string
1416
name: string
15-
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop'
17+
target?: ButtonProps['target']
1618
active?: boolean
1719
}[]
1820
}[]

src/components/List/list.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ButtonProps } from '../Button/button'
2+
13
export type ListEventType = {
24
value: string
35
name: string
@@ -19,7 +21,7 @@ export type ListProps = {
1921
name: string
2022
value?: string
2123
href?: string
22-
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop'
24+
target?: ButtonProps['target']
2325
selected?: boolean
2426
disabled?: boolean
2527
icon?: string

src/components/Menu/menu.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import type { ButtonProps } from '../Button/button'
2+
13
export type MenuProps = {
24
items?: {
35
href: string
46
name: string
5-
target?: string
7+
target?: ButtonProps['target']
68
active?: boolean
79
}[]
810
logo?: {

src/components/Rating/rating.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ButtonProps } from '../Button/button'
2+
13
export type RatingProps = {
24
score: number
35
total?: number
@@ -8,7 +10,7 @@ export type RatingProps = {
810
reviewCount?: number
911
reviewText?: string
1012
reviewLink?: string
11-
reviewTarget?: string
13+
reviewTarget?: ButtonProps['target']
1214
color?: string
1315
emptyColor?: string
1416
size?: number

src/components/Switch/switch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export type SwitchProps = {
1111
}
1212

1313
export type SvelteSwitchProps = {
14-
onClick?: (key: any) => any
14+
onClick?: ((event: MouseEvent) => void) | null
1515
} & SwitchProps
1616

1717
export type ReactSwitchProps = {
18-
onClick?: (key: any) => any
18+
onClick?: (event: React.MouseEvent) => void
1919
} & SwitchProps

0 commit comments

Comments
 (0)