Skip to content

Commit 1b4c02c

Browse files
committed
fix tsc errors
1 parent 4e16397 commit 1b4c02c

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/Options.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ const Options: React.FC<OptionsProps> = ({
6767
};
6868

6969
const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
70-
if (goButton || goInputText === '') return;
70+
if (goButton || goInputText === '') {
71+
return;
72+
}
7173
setGoInputText('');
7274
if (
7375
e.relatedTarget &&
@@ -78,8 +80,10 @@ const Options: React.FC<OptionsProps> = ({
7880
quickGo?.(getValidValue());
7981
};
8082

81-
const go = (e: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent) => {
82-
if (goInputText === '') return;
83+
const go = (e: any) => {
84+
if (goInputText === '') {
85+
return;
86+
}
8387
if (e.keyCode === KEYCODE.ENTER || e.type === 'click') {
8488
setGoInputText('');
8589
quickGo?.(getValidValue());

src/Pagination.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const Pagination: React.FC<PaginationProps> = (props) => {
118118
return iconNode as React.ReactNode;
119119
};
120120

121-
const getValidValue = (e: React.ChangeEvent<HTMLInputElement>): number => {
121+
const getValidValue = (e: any): number => {
122122
const inputValue = e.target.value;
123123
const allPages = calculatePage(undefined, pageSize, total);
124124

@@ -174,6 +174,7 @@ const Pagination: React.FC<PaginationProps> = (props) => {
174174
setInternalInputVal(value);
175175
}
176176

177+
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
177178
const keyActions: { [key: number]: () => void } = {
178179
[KeyCode.ENTER]: () => handleChange(value),
179180
[KeyCode.UP]: () => handleChange(value - 1),
@@ -212,8 +213,8 @@ const Pagination: React.FC<PaginationProps> = (props) => {
212213

213214
const runIfEnter = (
214215
event: React.KeyboardEvent<HTMLLIElement>,
215-
callback: () => void,
216-
...restParams: any[]
216+
callback,
217+
...restParams
217218
) => {
218219
if (
219220
event.key === 'Enter' ||
@@ -239,7 +240,7 @@ const Pagination: React.FC<PaginationProps> = (props) => {
239240
'prev',
240241
getItemIcon(prevIcon, 'prev page'),
241242
);
242-
return React.isValidElement(prevButton)
243+
return React.isValidElement<HTMLButtonElement>(prevButton)
243244
? React.cloneElement(prevButton, { disabled: !hasPrev })
244245
: prevButton;
245246
};
@@ -250,7 +251,7 @@ const Pagination: React.FC<PaginationProps> = (props) => {
250251
'next',
251252
getItemIcon(nextIcon, 'next page'),
252253
);
253-
return React.isValidElement(nextButton)
254+
return React.isValidElement<HTMLButtonElement>(nextButton)
254255
? React.cloneElement(nextButton, { disabled: !hasNext })
255256
: nextButton;
256257
};

0 commit comments

Comments
 (0)