Now, if I hover on the same, it will show the type any.
We have already seen in previous post, few primitive types in action. But, let us see again for refresher.
Let us go ahead and look at the same with examples. Below is the TS and equivalent JS snippet. However, there is nothing much difference between these scripts in this case.
As you can see the snippet, here anything can be passed as argument. In this case, I have passed number and below is the result for the same.
I can also pass any string value as well while calling the function.
Now, if I hover on the calling function, It will give very crisp definition for the function as shown below in the screenshot.
As you can see in the above screenshot, it is saying logMe is a function which is returning nothing, although logging the message in console, taking arg as one argument, which is implicitly getting converted to type any.
With the above change in place, it will produce the following output.
I hope you would have liked today’s post. We will delve further around the same in coming posts. Thanks for Joining me.
1,742 total views, 1 views today