From a4560c4eb2a519b744d30db3509c8e17efc9dbe3 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 7 Nov 2019 13:48:58 -0800 Subject: [PATCH] Update readme for 2.0-2.7 deprecation (#40222) * Update readme for 2.0-2.7 deprecation * Add example of dist-tags with react * shorten dist-tag table --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f53bc628a3..9da234fc32 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,23 @@ If you still can't find it, check if it [bundles](http://www.typescriptlang.org/ This is usually provided in a `"types"` or `"typings"` field in the `package.json`, or just look for any ".d.ts" files in the package and manually include them with a `/// `. +#### Typescript 2.7 and earlier + +Definitely Typed only tests packages on Typescript 2.8 and later, as of November 2019. +If you're using Typescript 2.0 to 2.7, you can still try installing `@types` packages — the majority of packages don't use fancy new Typescript features. +But there's no guarantee that they'll work. +Packages that existed before November 2019 may have older versions that are explicitly marked compatible with older versions of Typescript; use the tag "ts2.6" for Typescript 2.6, for example. + +For example, if you run `npm dist-tags @types/react`, you'll see the following table that shows that react@16.4 has types for Typescript 2.6: + +|Tag | Version| +|----|---------| +|latest| 16.9.11| +|ts2.0| 15.0.1| +| ... | ... | +|ts2.6| 16.4.7| +| ... | ... | + ### Other methods @@ -317,9 +334,9 @@ compiler options. Do not change the type definition if it is accurate. For an NPM package, `export =` is accurate if `node -p 'require("foo")'` works to import a module, and `export default` is accurate if `node -p 'require("foo").default'` works to import a module. -#### I want to use features from TypeScript 2.1 or above. +#### I want to use features from TypeScript 2.9 or above. -Then you will have to add a comment to the last line of your definition header (after `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`): `// TypeScript Version: 2.1`. +Then you will have to add a comment to the last line of your definition header (after `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`): `// TypeScript Version: 2.9`. #### I want to use features from TypeScript 3.1 or above.