declaration-files

How can I install @types compatible with an older version of TypeScript?

99封情书 提交于 2019-12-10 10:35:42
问题 My project uses package like @types/express and @types/body-parser . Recently these .d.ts files were updated to use generic defaults, but that means these declaration files now require TypeScript 2.3 or above. However, my project still uses an older version of TypeScript - TypeScript 2.2. How do I use npm to make sure my project can still understand these definition files without upgrading? 回答1: The @types publisher tool actually tags releases based on compatibility. To be able to install

How can I install @types compatible with an older version of TypeScript?

南笙酒味 提交于 2019-12-06 06:05:30
My project uses package like @types/express and @types/body-parser . Recently these .d.ts files were updated to use generic defaults, but that means these declaration files now require TypeScript 2.3 or above. However, my project still uses an older version of TypeScript - TypeScript 2.2. How do I use npm to make sure my project can still understand these definition files without upgrading? The @types publisher tool actually tags releases based on compatibility. To be able to install declaration files that are compatible with TypeScript 2.2, you can write npm install @types/body-parser@ts2.2