I want to add Typescript to an existing project.
The problem is that the type to be used as an input value is ambiguous.
Because in an existing project, I only used a string value as an input value.
For example, when I enter an price, I used to initialize it with an empty string value("") to see the placeholder at first.
Only numeric string can be entered via validation function and added comma to value when blur event is fired.
However, when I send it to the backend, I changed it to a number so all the data I get from the backend is a numeric type.
I'm trying to define data and types on the redux, but is it right to just declare it as a union type?
Or is there a better way?
This is the item type that I defined.
I want to use quantity and price as input value, but it's type is number so, I got a type error.
export interface Item {
id: number
category: string
quantity: number
price: number;
}