Fork me on GitHub

DefinitelyTyped

The repository for high quality TypeScript type definitions

Contribution guide

This guide covers contributing definitions. For information on contributing to the website go the website update guide.

see README.md and PULL_REQUEST_TEMPLATE.md first.

Content

The typing must have a header with the following format:

// Type definitions for [LIBRARY NAME]
// Project: [LIBRARY URL]
// Definitions by: [AUTHOR NAME] <[AUTHOR URL]>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

If the version of the library is known then add it as a semver to the label.

// Type definitions for Backbone v0.9.10
// Project: http://backbonejs.org/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

Namespacing

Be careful to use a module to avoid conflicts to your internal interfaces and the interfaces from another typings. See best practices and the TypeScript wiki for some tips.

The jQuery.bbq typing has the interfaces in a module named JQueryBbq

Example:

module JQueryBbq {
    interface JQuery {
        //...
    }
    //...
}
interface JQueryStatic {
    bbq: JQueryBbq.JQuery;
    //...
}

See the best practices for more info on how to structure a definition file.

Code style

At this point we do not enforce a specific general code style, but we do like idiomatic code in each individual file.
When creating a new definition file the author is free to choose either tabs or 4-space indentation (discussion on github).
Choice between Unix or Windows linebreaks is not enforced, as node.js doesn't care for it either way. Try to keep it idiomatic per file.
When editing an existing file please maintain the existing style as much as possible, this includes indenting, separator whitespace, bracing etc..
Do not use fancy code alignments or smart-tabs; instead keep things plain and simple.
It is discouraged to reformat existing code (as it breaks git attribution).
When preparing a Pull Request please check git diff (locally or on github) for unnecessary changes.
Regard the typing folder in your project as external resource and exclude it from your linter/formatter workflow, just like any library file.

Private APIs

We do not support exposing undocumented internal implementation details of libraries in .d.ts files. We follow this more strictly for popular libraries with good documentation e.g. jquery, angular, node etc.

Note

Keep in mind the repos is a community project with a wide range on quality in contributions and moderation; so there may be the occasional rule violation or historical artifact.

Contribute to the site via the contribution guide.