Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@
"prepare": "npx husky"
},
"dependencies": {
"@rc-component/overflow": "^1.0.0",
"@rc-component/resize-observer": "^1.0.0",
"@rc-component/trigger": "^3.6.15",
"@rc-component/util": "^1.3.0",
"clsx": "^2.1.1",
"rc-overflow": "^1.3.2"
"clsx": "^2.1.1"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
Expand Down
11 changes: 7 additions & 4 deletions src/PickerInput/Selector/SingleSelector/MultipleDates.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { clsx } from 'clsx';
import Overflow from 'rc-overflow';
import Overflow from '@rc-component/overflow';
import * as React from 'react';
import type { MouseEventHandler } from 'react';
import type { PickerProps } from '../../SinglePicker';

export interface MultipleDatesProps<DateType extends object = any>
extends Pick<PickerProps, 'maxTagCount'> {
export interface MultipleDatesProps<DateType extends object = any> extends Pick<
PickerProps,
'maxTagCount'
> {
prefixCls: string;
value: DateType[];
onRemove: (value: DateType) => void;
Expand Down Expand Up @@ -33,7 +36,7 @@ export default function MultipleDates<DateType extends object = any>(
const overflowCls = `${selectionCls}-overflow`;

// ========================= Item =========================
function renderSelector(content: React.ReactNode, onClose?: React.MouseEventHandler) {
function renderSelector(content: React.ReactNode, onClose?: MouseEventHandler<HTMLSpanElement>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

While making the onClose handler's type more specific to MouseEventHandler<HTMLSpanElement> is a good intention, it creates a type conflict. The renderSelector function is called from renderItem with an onClose handler whose event argument is typed as React.MouseEvent (which defaults to MouseEvent<Element>). An argument of type MouseEvent<Element> is not assignable to a parameter of type MouseEvent<HTMLSpanElement>, which will likely cause a TypeScript compilation error. To fix this, you can revert this change.

Suggested change
function renderSelector(content: React.ReactNode, onClose?: MouseEventHandler<HTMLSpanElement>) {
function renderSelector(content: React.ReactNode, onClose?: React.MouseEventHandler) {

return (
<span
className={clsx(`${selectionCls}-item`)}
Expand Down