Skip to content

InputText has the wrong type #4

Description

@eduanc

Importing InputText and adding <InputText value={this.state.count} /> to the App.tsx crashes the app.

The Error:
~/primereact-typescript-quickstart/node_modules/primereact/components/inputtext/InputText.d.ts (3,11): Interface 'InputTextProps' incorrectly extends interface 'HTMLProps<HTMLInputElement>'. Types of property 'onInput' are incompatible. Type '((event: Event) => void) | undefined' is not assignable to type '((event: FormEvent<HTMLInputElement>) => void) | undefined'. Type '(event: Event) => void' is not assignable to type '((event: FormEvent<HTMLInputElement>) => void) | undefined'. Type '(event: Event) => void' is not assignable to type '(event: FormEvent<HTMLInputElement>) => void'. Types of parameters 'event' and 'event' are incompatible. Type 'FormEvent<HTMLInputElement>' is not assignable to type 'Event'. Property 'cancelBubble' is missing in type 'FormEvent<HTMLInputElement>'.

Simple workaround: removing extends React.HTMLProps<HTMLInputElement> or finding the right type for the InputText.d.ts file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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