Do @types use the same versioning as the untyped package?
npm i bluebird @types/bluebird -S
gives me
"@types/bluebird": "^3.5.0",
"bluebird": "^3.5.0",
Seems pretty reasonable.
npm i request @types/request -S
gives me
"@types/request": "0.0.41",
"request": "^2.81.0",
Now this scares me a bit. Does this mean that we only have request types for request version 0.0.41?
Yes, TypeScript is a devDependency and you can add it to your project using this command- 'npm install typescript --save-dev'. But before installing this compiler, you need a copy of Node. js as an environment to run the package.
Summary: The @types npm organization is for obtaining type definitions with npm . Using these type definitions is a feature is coming in TypeScript 2.0. This will replace the current projects/tools such as typings and tsd, though these will continue to be supported for some time.
In short, you should save a module as a devDependency when it's only used for development and testing; everything else should be a dependency. You might think this is straightforward, clear guidance, but like for users of my module, things can get murky in real life.
An NPM module can additionally supply TypeScript type information via a declaration file — additional TypeScript code that isn't executable, but simply describes the types to apply to the JavaScript code. A module specifies a declaration file with the types property in package. json .
Should typescript @types packages version match their non types packages?
No. TypeScript types for JS packages is best effort and depends on
So version mismatches are fine as long as you are aware of their best effort nature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With