Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputText/InputTextArea: Typescript won't allow setting value #3573

Closed
melloware opened this issue Nov 4, 2022 · 0 comments · Fixed by #3574
Closed

InputText/InputTextArea: Typescript won't allow setting value #3573

melloware opened this issue Nov 4, 2022 · 0 comments · Fixed by #3574
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add Typescript Issue or pull request is *only* related to TypeScript definition
Milestone

Comments

@melloware
Copy link
Member

Describe the bug

In Typescript if you do this to set the value programatically.

<InputText ref={ref} value={value}  />

<Button label="Click" onClick={() => {  if (ref.current) ref.current.value = 'Test';  }} />

You get the error Property 'value' does not exist on type 'InputText'.

Reproducer

No response

PrimeReact version

8.7.1

React version

17.x

Language

TypeScript

Build / Runtime

Next.js

Browser(s)

ALL

Steps to reproduce the behavior

<InputText ref={ref} value={value}  />

<Button label="Click" onClick={() => {  if (ref.current) ref.current.value = 'Test';  }} />

Compiler you will see the warning that value does not exist

Expected behavior

Allowed to set value like it was a regular HtmlInputText

@melloware melloware added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 4, 2022
@melloware melloware self-assigned this Nov 4, 2022
@melloware melloware added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add Typescript Issue or pull request is *only* related to TypeScript definition and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 4, 2022
@melloware melloware added this to the 8.7.2 milestone Nov 4, 2022
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 4, 2022
melloware added a commit to melloware/primereact that referenced this issue Nov 4, 2022
@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add Typescript Issue or pull request is *only* related to TypeScript definition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant