Skip to content

Commit

Permalink
type: fix type (#101)
Browse files Browse the repository at this point in the history
* type: fix type

* type: fix type
  • Loading branch information
afc163 authored Dec 31, 2024
1 parent 8e0fc6d commit a110e42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
"@testing-library/user-event": "^14.0.0-beta",
"@types/classnames": "^2.2.9",
"@types/jest": "^29.5.14",
"@types/react": "^18.3.12",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.1",
"@umijs/fabric": "^2.0.8",
"@umijs/fabric": "^4.0.0",
"coveralls": "^3.0.6",
"cross-env": "^7.0.2",
"dumi": "^2.1.14",
"eslint": "^7.0.0",
"eslint": "^8.0.0",
"father": "^4.3.7",
"gh-pages": "^6.2.0",
"husky": "^9.1.7",
Expand Down
15 changes: 9 additions & 6 deletions src/BaseInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ const BaseInput = React.forwardRef<HolderRef, BaseInputProps>((props, ref) => {

const hasAffix = hasPrefixSuffix(props);

let element: ReactElement = cloneElement(inputElement, {
let element: ReactElement = cloneElement(inputElement as ReactElement<any>, {
value,
className:
clsx(inputElement.props.className, !hasAffix && classNames?.variant) ||
null,
clsx(
(inputElement as ReactElement<any>).props?.className,
!hasAffix && classNames?.variant,
) || null,
});

// ======================== Ref ======================== //
Expand Down Expand Up @@ -191,10 +193,11 @@ const BaseInput = React.forwardRef<HolderRef, BaseInputProps>((props, ref) => {
}

// `className` and `style` are always on the root element
return React.cloneElement(element, {
className: clsx(element.props?.className, className) || null,
return React.cloneElement(element as ReactElement<any>, {
className:
clsx((element as ReactElement<any>).props?.className, className) || null,
style: {
...element.props?.style,
...(element as ReactElement<any>).props?.style,
...style,
},
hidden,
Expand Down

0 comments on commit a110e42

Please sign in to comment.