checkbox icon indicating copy to clipboard operation
checkbox copied to clipboard

Checkbox Event Type Error

Open GeekEast opened this issue 5 years ago • 1 comments

Issue

  • happens in e.target.checked: Property 'checked' does not exist on type 'EventTarget'.
<Checkbox checked={x} onChange={(e) => setX(e.target.checked)} />

Suggestion

  • in index.d.ts
export interface Props {
  onChange?: (e: Event) => void;
}
  • to sth like following
interface Target extends Props {
  checked: boolean;
}

interface ChangeEvent {
  target: Target;
  stopPropagation: () => void;
  preventDefault: () => void;
  nativeEvent: Object;
}

export interface Props {
  onChange?: (e: ChangeEvent) => void;
}

GeekEast avatar Nov 21 '20 06:11 GeekEast

@GeekEast https://github.com/react-component/checkbox/commit/ac34c5d721b75887270c44e888e75739d78a57eb

wangxingkang avatar Dec 08 '22 06:12 wangxingkang