mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #33892 from DefinitelyTyped/update-README-Mar-2019
Update README
This commit is contained in:
38
README.md
38
README.md
@@ -57,7 +57,7 @@ You may need to add manual [references](http://www.typescriptlang.org/docs/handb
|
||||
|
||||
## How can I contribute?
|
||||
|
||||
DefinitelyTyped only works because of contributions by users like you!
|
||||
Definitely Typed only works because of contributions by users like you!
|
||||
|
||||
### Test
|
||||
|
||||
@@ -89,7 +89,7 @@ then follow the instructions to [edit an existing package](#edit-an-existing-pac
|
||||
|
||||
### Make a pull request
|
||||
|
||||
Once you've tested your package, you can share it on DefinitelyTyped.
|
||||
Once you've tested your package, you can share it on Definitely Typed.
|
||||
|
||||
First, [fork](https://guides.github.com/activities/forking/) this repository, install [node](https://nodejs.org/), and run `npm install`.
|
||||
|
||||
@@ -117,7 +117,7 @@ If it doesn't, you can do so yourself in the comment associated with the PR.
|
||||
|
||||
#### Create a new package
|
||||
|
||||
If you are the library author and your package is written in TypeScript, [bundle the autogenerated declaration files](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) in your package instead of publishing to DefinitelyTyped.
|
||||
If you are the library author and your package is written in TypeScript, [bundle the autogenerated declaration files](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) in your package instead of publishing to Definitely Typed.
|
||||
|
||||
If you are adding typings for an NPM package, create a directory with the same name.
|
||||
If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM.
|
||||
@@ -137,7 +137,7 @@ See all options at [dts-gen](https://github.com/Microsoft/dts-gen).
|
||||
|
||||
You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option.
|
||||
|
||||
DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down.
|
||||
Definitely Typed members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down.
|
||||
|
||||
For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js).
|
||||
|
||||
@@ -165,17 +165,17 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D
|
||||
|
||||
#### Removing a package
|
||||
|
||||
When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from DefinitelyTyped to avoid confusion.
|
||||
When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from Definitely Typed to avoid confusion.
|
||||
|
||||
You can remove it by running `npm run not-needed -- typingsPackageName asOfVersion sourceRepoURL [libraryName]`.
|
||||
- `typingsPackageName`: This is the name of the directory to delete.
|
||||
- `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version.
|
||||
- `sourceRepoURL`: This should point to the repository that contains the typings.
|
||||
- `libraryName`: Descriptive name of the library, e.g. "Angular 2" instead of "angular2". (If ommitted, will be identical to "typingsPackageName".)
|
||||
- `libraryName`: Name of npm package that replaces the Definitely Typed types. Usually this is identical to "typingsPackageName" so you can omit it.
|
||||
|
||||
Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types. To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`.
|
||||
Any other packages in Definitely Typed that referenced the deleted package should be updated to reference the bundled types. To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`.
|
||||
|
||||
If a package was never on DefinitelyTyped, it does not need to be added to `notNeededPackages.json`.
|
||||
If a package was never on Definitely Typed, it does not need to be added to `notNeededPackages.json`.
|
||||
|
||||
|
||||
#### Lint
|
||||
@@ -225,11 +225,11 @@ The `master` branch is automatically published to the `@types` scope on NPM than
|
||||
|
||||
#### I've submitted a pull request. How long until it is merged?
|
||||
|
||||
It depends, but most pull requests will be merged within a week. PRs that have been approved by an author listed in the definition's header are usually merged more quickly; PRs for new definitions will take more time as they require more review from maintainers. Each PR is reviewed by a TypeScript or DefinitelyTyped team member before being merged, so please be patient as human factors may cause delays. Check the [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) to see progress as maintainers work through the open PRs.
|
||||
It depends, but most pull requests will be merged within a week. PRs that have been approved by an author listed in the definition's header are usually merged more quickly; PRs for new definitions will take more time as they require more review from maintainers. Each PR is reviewed by a TypeScript or Definitely Typed team member before being merged, so please be patient as human factors may cause delays. Check the [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) to see progress as maintainers work through the open PRs.
|
||||
|
||||
#### My PR is merged; when will the `@types` NPM package be updated?
|
||||
|
||||
NPM packages should update within a few minutes. If it's been more than an hour, mention the PR number on [the DefinitelyTyped Gitter channel](https://gitter.im/DefinitelyTyped/DefinitelyTyped) and the current maintainer will get the correct team member to investigate.
|
||||
NPM packages should update within a few minutes. If it's been more than an hour, mention the PR number on [the Definitely Typed Gitter channel](https://gitter.im/DefinitelyTyped/DefinitelyTyped) and the current maintainer will get the correct team member to investigate.
|
||||
|
||||
#### I'm writing a definition that depends on another definition. Should I use `<reference types="" />` or an import?
|
||||
|
||||
@@ -325,13 +325,13 @@ You can look [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast
|
||||
This may belong in [TSJS-Lib-Generator](https://github.com/Microsoft/TSJS-lib-generator#readme). See the guidelines there.
|
||||
If the standard is still a draft, it belongs here.
|
||||
Use a name beginning with `dom-` and include a link to the standard as the "Project" link in the header.
|
||||
When it graduates draft mode, we may remove it from DefinitelyTyped and deprecate the associated `@types` package.
|
||||
When it graduates draft mode, we may remove it from Definitely Typed and deprecate the associated `@types` package.
|
||||
|
||||
#### How do DefinitelyTyped package versions relate to versions of the corresponding library?
|
||||
#### How do Definitely Typed package versions relate to versions of the corresponding library?
|
||||
|
||||
_NOTE: The discussion in this section assumes familiarity with [Semantic versioning](https://semver.org/)_
|
||||
|
||||
Each DefinitelyTyped package is versioned when published to NPM.
|
||||
Each Definitely Typed package is versioned when published to NPM.
|
||||
The [types-publisher](https://github.com/Microsoft/types-publisher) (the tool that publishes `@types` packages to npm) will set the declaration package's version by using the `major.minor` version number listed in the first line of its `index.d.ts` file.
|
||||
For example, here are the first few lines of [Node's type declarations](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/1253faabf5e0d2c5470db6ea87795d7f96fef7e2/types/node/index.d.ts) for version `10.12.x` at the time of writing:
|
||||
|
||||
@@ -339,24 +339,24 @@ For example, here are the first few lines of [Node's type declarations](https://
|
||||
// Type definitions for Node.js 10.12
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
||||
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
||||
// Definitely Typed <https://github.com/DefinitelyTyped>
|
||||
// Alberto Schiabel <https://github.com/jkomyno>
|
||||
```
|
||||
|
||||
Because `10.12` is at the end the first line, the npm version of the `@types/node` package will also be `10.12.x`.
|
||||
Note that the first-line comment in the `index.d.ts` file should only contain the `major.minor` version (e.g. `10.12`) and should not contain a patch version (e.g. `10.12.4`).
|
||||
This is because only the major and minor release numbers are aligned between library packages and type declaration packages.
|
||||
The patch release number of the type declaration package (e.g. `.0` in `10.12.0`) is initialized to zero by DefinitelyTyped and is incremented each time a new `@types/node` package is published to NPM for the same major/minor version of the corresponding library.
|
||||
The patch release number of the type declaration package (e.g. `.0` in `10.12.0`) is initialized to zero by Definitely Typed and is incremented each time a new `@types/node` package is published to NPM for the same major/minor version of the corresponding library.
|
||||
|
||||
Sometimes type declaration package versions and library package versions can get out of sync.
|
||||
Below are a few common reasons why, in order of how much they inconvenience users of a library.
|
||||
Only the last case is typically problematic.
|
||||
|
||||
* As noted above, the patch version of the type declaration package is unrelated to the library patch version.
|
||||
This allows DefinitelyTyped to safely update type declarations for the same major/minor version of a library.
|
||||
This allows Definitely Typed to safely update type declarations for the same major/minor version of a library.
|
||||
* If updating a package for new functionality, don't forget to update the version number to line up with that version of the library.
|
||||
If users make sure versions correspond between JavaScript packages and their respective `@types` packages, then `npm update` should typically just work.
|
||||
* It's common for type declaration package updates to lag behind library updates because it's often library users, not maintainers, who update DefinitelyTyped when new library features are released.
|
||||
* It's common for type declaration package updates to lag behind library updates because it's often library users, not maintainers, who update Definitely Typed when new library features are released.
|
||||
So there may be a lag of days, weeks, or even months before a helpful community member sends a PR to update the type declaration package for a new library release.
|
||||
If you're impacted by this, you can be the change you want to see in the world and you can be that helpful community member!
|
||||
|
||||
@@ -366,7 +366,7 @@ Only the last case is typically problematic.
|
||||
|
||||
[Semantic versioning](https://semver.org/) requires that versions with breaking changes must increment the major version number.
|
||||
For example, a library that removes a publicly exported function after its `3.5.8` release must bump its version to `4.0.0` in its next release.
|
||||
Furthermore, when the library's `4.0.0` release is out, its DefinitelyTyped type declaration package should also be updated to `4.0.0`, including any breaking changes to the library's API.
|
||||
Furthermore, when the library's `4.0.0` release is out, its Definitely Typed type declaration package should also be updated to `4.0.0`, including any breaking changes to the library's API.
|
||||
|
||||
Many libraries have a large installed base of developers (including maintainers of other packages using that library as a dependency) who won't move right away to a new version that has breaking changes, because it might be months until a maintainer has time to rewrite code to adapt to the new version.
|
||||
In the meantime, users of old library versions still may want to update type declarations for older versions.
|
||||
@@ -398,7 +398,7 @@ At the time of writing, the [history v2 `tsconfig.json`](https://github.com/Defi
|
||||
}
|
||||
```
|
||||
|
||||
If there are other packages in DefinitelyTyped that are incompatible with the new version, you will need to add path mappings to the old version.
|
||||
If there are other packages in Definitely Typed that are incompatible with the new version, you will need to add path mappings to the old version.
|
||||
You will also need to do this recursively for packages depending on packages depending on the old version.
|
||||
|
||||
For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/v2/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`.
|
||||
|
||||
Reference in New Issue
Block a user