I
I
Im p3l2021-06-29 11:44:04
React
Im p3l, 2021-06-29 11:44:04

How to fix Property 'placeholder' does not exist on type error?

Good afternoon, please tell me how to solve the error Property 'placeholder' does not exist on type 'FormTypes'. Property 'placeholder' does not exist on type 'RadioType'.
Here is my code:

type InputType = {
  value: string;
  name: string;
  placeholder: string
}

type RadioType = {
  value: string;
  name: string;
}
type FormTypes = InputType | RadioType;


<Input
  value={inputValue}
  name={name}
  placeholder={placeholder}
/>
<Radio
  value={value}
  name={name}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2021-06-29
@bingo347

https://www.typescriptlang.org/docs/handbook/2/nar...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question