Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why we need @types in TypeScript

I am new to typescript and decided to install and work with Lodash. Then, I found out that I needed to install @types/lodash which is TypeScript version of Lodash (I hope I am right). Is it true that we need to install javascript version of Lodash first in order to use @types/lodash?

like image 424
QQQQQ Avatar asked Nov 28 '25 19:11

QQQQQ


1 Answers

You do not have to install @types/lodash package, however, it is good to install it. The package contains type definitions, so your IDE can smartly hint you and you will be able to strictly define types for parameters etc.

To be accurate, @types/lodash is not a TypeScript version of Lodash - it is only package with type definitions, so you have to install Loadash via npm i --save lodash to be able to use it and optionally download the type package.

like image 148
dev0experiment Avatar answered Dec 01 '25 10:12

dev0experiment



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!