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
This commit is contained in:
Nathan Shively-Sanders 2019-11-07 13:48:58 -08:00 committed by GitHub
parent c967251c42
commit a4560c4eb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 `/// <reference path="" />`.
#### 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 &mdash; 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.