Hello again 👋
As you can see the warning we got by hovering over the parameter in the function is telling us that this parameter is of
any type which is not good at all. So how can you expect only a
string into the function without TypeScript?
The easiest way to do it is to add the
string argument in the function call and then do this 👇.
The 2nd way looks neater to me.
Besides, you can also spot silly bugs which are very bad. Some are listed below:
TIP: To enable
// @ts-checkfor every
.jsfile, you can simply enable this setting in VS Code.
And to ignore checking in any file, just use
// @ts-nocheck on the top of the file.
For more information about those types for parameters, you can refer to the JSDoc Documentation.
Did you find this article valuable?
Support Usman Sabuwala by becoming a sponsor. Any amount is appreciated!