
Getting Started with TypeScript
Ladybug Podcast
00:00
How to Pass a Function as an Argument?
In javiscript, a variable is undefined. In typescript, it's called higher order functions or callbacks. If you want to note that a variable actually contains a function, we can note this with the function keyword. Typing functions as variable is a little bit tricky. But i will say that that was the most difficult concept of this episode. And if you simply do not know what type of date you are expecting, there's actually a type unknown. This is better than using any. So for example, if we're relying on user input, we don't know after what type of data they're going to enter. I recommend using unknown in place of any.
Transcript
Play full episode