Answer the question
In order to leave comments, you need to log in
How to work with types in typescript?
Maybe I'm asking a too simple question or have forgotten how to google. But I'll ask anyway.
I deal with ts. The basis of the idea, because of which I began to deal with him, is types. Tired of fencing footcloths if and wrapping variables in all sorts of Number (varName). There is such a simple example .
The essence is simple - to receive values from inputs and to add. But in the sandbox, I get 404. When compiling to js, I get 3 errors, 2 of which are the absence of a value on the htmlelemet object and one more - innerHTML expects a string as input. OK. Not my fault at all, but oh well.
After compilation, I expected that in the js version of the code I would see a condition for type checking and type casting. But I saw my own code, only without number... Is that normal? What am I doing wrong?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question