* Implemented specs from Highcharts v5.0.0 Conform changelog at https://www.highcharts.com/documentation/changelog, implemented the following changes: - Added styled mode for optional separation of SVG and CSS. - Added responsive option set. - Added accessibility option set. - Added new function, Chart.update in order to update the chart options after render time. - Added new function, Chart.addCredits. - Added new function, Chart.title.update. - Added new function, Chart.credits.update. - Added new function, Legend.update. - Added new option, Renderer.definition. - Added new option, exporting.error for catching errors in offline exporting. - Added new option, exporting.libURL for use with offline exporting. - Added new option, pane.background.className. - Added new option, xAxis.className. - Added new option, xAxis.crosshair.className. - Added new option, plotOptions.series.dataLabels.className. - Added new option, plotOptions.series.className for styling individual series. - Added new option, xAxis.plotBands.className. - Added new option, xAxis.plotLines.className. - Added new option, plotOptions.series.zones.className. - Added new option, chart.colorCount for use in styled mode. - Added new option, defs for defining reusable elements in styled mode. - Added new option, tooltip.padding. - Added new option, series<line>.data.colorIndex for coloring points in styled mode. - Added new option, tooltip.split. - Added new option, chart.description for use with the accessibility module. - Added new option, chart.typeDescription for use with the accessibility module. - Added new option, xAxis.description for use with the accessibility module. - Added new option, plotOptions.series.description for use with the accessibility module. - Refactored build system to use ES6 imports and node-based build script. - Changed all default colors (except series data colors) to a simplified color scheme based on just a few shared colors. Additional improvements (found throughout the documentation): - Changed reference from `color?: string` to `color?: Color` throughout the different Options objects (this broke Typescript intellisense before) - ChartObject.xAxis now accepts also a single AxisObject, as well as Array<AxisObject> - ChartObject.yAxis now accepts also a single AxisObject, as well as Array<AxisObject> - Important: a handful changes already implemented by community contributors are left alone * Implemented specs from Highcharts 5.0.1 (2016-10-26) Conform changelog at https://www.highcharts.com/documentation/changelog, implemented the following changes: - Added new options, axis.softMin and axis.softMax. No further documentation linked on the following subjects/changes (= ignored): - Added Legend keyboard navigation to the accessibility module. - Added animation on hovering point markers. - Added offline PDF export support. * Implemented Highcharts 5.0.3 (2016-11-18) - Added new option, lang.numericSymbolMagnitude, to support numeric symbol shortening in Japanese, Korean and certain Chinese locales. - Added new option, threshold, for solid gauge series. - Added new CSS custom property, textOutline, and at the same time removed the textShadow shim. Closes #5849. Ignored due to being implementation-only, or lack of documentation: - Better implementation of the chart.pinchType option. Allow pinchType and zoomType to be set independently. When tooltip.followTouchMove is true, pinchType only applies to two-finger touches. Closes #5840. - Changed the Highcharts.addEvent function to return a callback to be used to remove the same event. - Implemented bubbles in the Boost module. - Improved alignment of ticks on multiple axes by allowing ticks to be placed at less strict intervals. - Refactored split tooltip connectors to use common callback shape instead. * Highcharts 5.0.7 (2017-01-17) - Added new option, global.timezone, as a convenient shortcut to timezones defined with moment.js. - Changed the Highcharts.error function to handle strings. Ignored due to being implementation-only, or lack of documentation: - Added Legend keyboard navigation to accessibility module. - Added chart render and predraw events needed by the new Boost module. - Added optional redraw to drillToNode, related to #6180. - Added support for marker.symbol setting on bubble charts. - Changed the Highcharts.addEvent function to return a callback to be used to remove the same event. * Highcharts 5.0.8 (2017-03-08) Conform changelog at https://www.highcharts.com/documentation/changelog, implemented the following changes: - Added animation on graph mouse over and mouse out. - Added new option, solidgauge.rounded. - Added support for relative chart.height as a percentage of the width. This allows for fixed aspect ratio. Ignored due to being implementation-only, or lack of documentation: - Added a refactored Boost module based on WebGL. Details and API to be announced. - Added hooks so that users can define their own log axis conversion functions, and can advertise that the log axis should allow negative values. * Highcharts 5.0.10 (2017-03-31) Conform changelog at https://www.highcharts.com/documentation/changelog, implemented the following changes: - Added new option, plotOptions.column.crisp, to allow disabling crisp columns and subsequent rendering issues with densely packed items. Closes #5755. - Added new option, findNearestPointBy to declare how the tooltip searches for points. #6231. Ignored due to being implementation-only, or lack of documentation: - Added !default statement to SASS variables for easier configuration. Closes #6436. - Refactored the Pane object to keep track of its own backgrounds, more decoupled from Axis. * Fixed dtslint warnings and errors for CI This fixes all tslint/dtslint errors, incl. historic errors. #vanity - Fixed: Array type using 'Array<T>' is forbidden for simple types. Use 'T[]' instead. - Fixed: Exceeds maximum line length of 200 - Fixed: trailing whitespace - Fixed: missing semicolon - Fixed: Consecutive blank lines are forbidden - Fixed: non-arrow functions are forbidden - Fixed: missing whitespace - Fixed: Don't leave a blank line before/after '{' / '}' - Fixed: Do not use 'var'
DefinitelyTyped 
The repository for high quality TypeScript type definitions.
Also see the definitelytyped.org website, although information in this README is more up-to-date.
What are declaration files?
See the TypeScript handbook.
How do I get them?
npm
This is the preferred method. This is only available for TypeScript 2.0+ users. For example:
npm install --save-dev @types/node
The types should then be automatically included by the compiler. See more in the handbook.
For an NPM package "foo", typings for it will be at "@types/foo". If you can't find your package, look for it on TypeSearch.
If you still can't find it, check if it bundles its own typings.
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="" />.
Other methods
These can be used by TypeScript 1.0.
- Typings
NuGet(use preferred alternatives, nuget DT type publishing has been turned off)- Manually download from the
masterbranch of this repository
You may need to add manual references.
How can I contribute?
DefinitelyTyped only works because of contributions by users like you!
Test
Before you share your improvement with the world, use it yourself.
Test editing an existing package
To add new features you can use module augmentation.
You can also directly edit the types in node_modules/@types/foo/index.d.ts, or copy them from there and follow the steps below.
Test a new package
Add to your tsconfig.json:
"baseUrl": "types",
"typeRoots": ["types"],
(You can also use src/types.)
Create types/foo/index.d.ts containing declarations for the module "foo".
You should now be able import from "foo" in your code and it will route to the new type definition.
Then build and run the code to make sure your type definition actually corresponds to what happens at runtime.
Once you've tested your definitions with real code, make a PR
then follow the instructions to edit an existing package or
create a new package.
Make a pull request
Once you've tested your package, you can share it on DefinitelyTyped.
First, fork this repository, install node, and run npm install.
Edit an existing package
cd types/my-package-to-edit- Make changes. Remember to edit tests.
- You may also want to add yourself to "Definitions by" section of the package header.
- Do this by adding your name to the end of the line, as in
// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>. - Or if there are more people, it can be multiline
// Definitions by: Alice <https://github.com/alice> // Bob <https://github.com/bob> // Steve <https://github.com/steve> // John <https://github.com/john> - Do this by adding your name to the end of the line, as in
- If there is a
tslint.json, runnpm run lint package-name. Otherwise, runtscin the package directory.
When you make a PR to edit an existing package, dt-bot should @-mention previous authors.
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, or can make a pull request to the library, bundle types instead of publishing to DefinitelyTyped.
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.
(You can use npm info foo to check for the existence of the foo package.)
Your package should have this structure:
| File | Purpose |
|---|---|
| index.d.ts | This contains the typings for the package. |
| foo-tests.ts | This contains sample code which tests the typings. This code does not run, but it is type-checked. |
| tsconfig.json | This allows you to run tsc within the package. |
| tslint.json | Enables linting. |
Generate these by running npm install -g dts-gen and dts-gen --dt --name my-package-name --template module.
See all options at 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.
For a good example package, see base64-js.
Common mistakes
- First, follow advice from the handbook.
- Formatting: Either use all tabs, or always use 4 spaces.
interface Foo { new(): Foo; }: This defines a type of objects that are new-able. You probably wantdeclare class Foo { constructor(); }.const Class: { new(): IClass; }: Prefer to use a class declarationclass Class { constructor(); }instead of a new-able constant.getMeAT<T>(): T: If a type parameter does not appear in the types of any parameters, you don't really have a generic function, you just have a disguised type assertion. Prefer to use a real type assertion, e.g.getMeAT() as number. Example where a type parameter is acceptable:function id<T>(value: T): T;. Example where it is not acceptable:function parseJson<T>(json: string): T;. Exception:new Map<string, number>()is OK.
Removing a package
When a package bundles its own types, types should be removed from DefinitelyTyped 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/foowith 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".)
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" }.
If a package was never on DefinitelyTyped, it does not need to be added to notNeededPackages.json.
Lint
To lint a package, just add a tslint.json to that package containing { "extends": "dtslint/dt.json" }. All new packages must be linted.
If a tslint.json turns rules off, this is because that hasn't been fixed yet. For example:
{
"extends": "dtslint/dt.json",
"rules": {
// This package uses the Function type, and it will take effort to fix.
"ban-types": false
}
}
(To indicate that a lint rule truly does not apply, use // tslint:disable rule-name or better, //tslint:disable-next-line rule-name.)
Test by running npm run lint package-name where package-name is the name of your package.
This script uses dtslint.
FAQ
What exactly is the relationship between this repository and the @types packages on NPM?
The master branch is automatically published to the @types scope on NPM thanks to types-publisher.
This usually happens within an hour of changes being merged.
I'm writing a definition that depends on another definition. Should I use <reference types="" /> or an import?
If the module you're referencing is an external module (uses export), use an import.
If the module you're referencing is an ambient module (uses declare module, or just declares globals), use <reference types="" />.
I notice some packages having a package.json here.
Usually you won't need this. When publishing a package we will normally automatically create a package.json for it.
A package.json may be included for the sake of specifying dependencies. Here's an example.
We do not allow other fields, such as "description", to be defined manually.
Also, if you need to reference an older version of typings, you must do that by adding "dependencies": { "@types/foo": "x.y.z" } to the package.json.
Some packages have no tslint.json, and some tsconfig.json are missing "noImplicitAny": true, "noImplicitThis": true, or "strictNullChecks": true.
Then they are wrong. You can help by submitting a pull request to fix them.
Can I request a definition?
Here are the currently requested definitions.
What about type definitions for the DOM?
If types are part of a web standard, they should be contributed to TSJS-lib-generator so that they can become part of the default lib.dom.d.ts.
A package uses export =, but I prefer to use default imports. Can I change export = to export default?
If default imports work in your environment, consider turning on the --allowSyntheticDefaultImports compiler option.
Do not change the type definition if it is accurate.
For an NPM package, export = is accurate if node -p 'require("foo")' is the export, and export default is accurate if node -p 'require("foo").default' is the export.
I want to use features from TypeScript 2.1 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.
I want to add a DOM API not present in TypeScript by default.
This may belong in TSJS-Lib-Generator. 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.
I want to update a package to a new major version
Before making your change, please create a new subfolder with the current version e.g. v2, and copy existing files to it. You will need to:
- Update the relative paths in
tsconfig.jsonas well astslint.json. - Add path mapping rules to ensure that tests are running against the intended version.
For example history v2 tsconfig.json looks like:
{
"compilerOptions": {
"baseUrl": "../../",
"typeRoots": ["../../"],
"paths": {
"history": [ "history/v2" ]
},
},
"files": [
"index.d.ts",
"history-tests.ts"
]
}
Please note that unless upgrading something backwards-compatible like node, all packages depending of the updated package need a path mapping to it, as well as packages depending on those.
For example, react-router depends on history@2, so react-router tsconfig.json has a path mapping to "history": [ "history/v2" ];
transitively react-router-bootstrap (which depends on react-router) also adds a path mapping in its tsconfig.json.
Also, /// <reference types=".." /> will not work with path mapping, so dependencies must use import.
What about scoped packages?
Types for a scoped package @foo/bar should go in types/foo__bar. Note the double underscore.
The file history in GitHub looks incomplete.
GitHub doesn't support file history for renamed files. Use git log --follow instead.
License
This project is licensed under the MIT license.
Copyrights on the definition files are respective of each contributor listed at the beginning of each definition file.