Answer the question
In order to leave comments, you need to log in
Can a variable be typed as strings or object?
Good day. I have a variable "Simple: any". For me, this variable should be a string by default.
It must be a string because by default it is in the FormControle as setState. But an object can fly into it. Is it possible to type a variable to be a string and an object? And not just the any type?
Answer the question
In order to leave comments, you need to log in
You can:
And it will be even better if you describe how your object looks like, for example:
Simple: string | Object
{
field1: string,
field2: number
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question