Skip to content

Checkbox Event Type Error #205

@GeekEast

Description

@GeekEast

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions