Skip to content

Commit 162914c

Browse files
committed
fix: fix type error
This commit is generated by cursor and reviewed by @Keith-CY
1 parent 421e75b commit 162914c

File tree

1 file changed

+28
-25
lines changed
  • packages/neuron-ui/src/widgets/TextField

1 file changed

+28
-25
lines changed

packages/neuron-ui/src/widgets/TextField/index.tsx

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,33 @@ import Edit from 'widgets/Icons/Edit.svg?react'
44
import { EyesClose, EyesOpen } from 'widgets/Icons/icon'
55
import styles from './textField.module.scss'
66

7-
const TextField = React.forwardRef(
7+
const TextField = React.forwardRef<
8+
HTMLDivElement,
9+
{
10+
field: string
11+
label?: string | React.ReactNode
12+
value?: string
13+
hint?: string
14+
error?: string
15+
type?: 'text' | 'password' | 'file'
16+
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void
17+
onClick?: (e: React.SyntheticEvent<HTMLInputElement | HTMLTextAreaElement>) => void
18+
className?: string
19+
prefix?: string | React.ReactNode | undefined
20+
suffix?: string | React.ReactNode | undefined
21+
stack?: boolean
22+
required?: boolean
23+
readOnly?: boolean
24+
placeholder?: string
25+
disabled?: boolean
26+
selected?: boolean
27+
width?: string
28+
rows?: number
29+
errorWithIcon?: boolean
30+
tabIndex?: number
31+
[key: string]: any
32+
}
33+
>(
834
(
935
{
1036
label,
@@ -28,31 +54,8 @@ const TextField = React.forwardRef(
2854
rows = 1,
2955
errorWithIcon = false,
3056
...rest
31-
}: {
32-
field: string
33-
label?: string | React.ReactNode
34-
value?: string
35-
hint?: string
36-
error?: string
37-
type?: 'text' | 'password' | 'file'
38-
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void
39-
onClick?: (e: React.SyntheticEvent<HTMLInputElement | HTMLTextAreaElement>) => void
40-
className?: string
41-
prefix?: string | React.ReactNode | undefined
42-
suffix?: string | React.ReactNode | undefined
43-
stack?: boolean
44-
required?: boolean
45-
readOnly?: boolean
46-
placeholder?: string
47-
disabled?: boolean
48-
selected?: boolean
49-
[key: string]: any
50-
width?: string
51-
rows?: number
52-
errorWithIcon?: boolean
53-
tabIndex?: number
5457
},
55-
ref: React.LegacyRef<HTMLDivElement>
58+
ref
5659
) => {
5760
const [isPasswordHidden, setIsPasswordHidden] = useState(true)
5861
const inputRef = useRef<(HTMLTextAreaElement & HTMLInputElement) | null>(null)

0 commit comments

Comments
 (0)