Simple documentation for @types contributors.
If you're creating a repository under @types
, make sure to follow the existing naming guidelines. That is, <source>-<lib name>
. The list of sources can be viewed in the registry.
Using npm-quickly-copy-file
as an example, make sure you have the following set up to ease contributing.
- Make sure you have a descriptive README with, at least, a link to the source repository (
README.md
) - Set up
tsconfig.json
using the minimum required settings (seetsconfig.json
settings) (tsconfig.json
) - The work should be licensed under MIT, or similar, to enable redistribution (
LICENSE
) - Create a
package.json
with the@types/<pkg>
name, testing scripts (usingtsc
andts-node
),typings
field and development dependencies - there should be no implicit dependencies (package.json
) - Create the
typings.json
version with original package name (typings.json
) - I recommend checking in an
.editorconfig
file for people to follow (.editorconfig
) - Make sure all generated assets are
.gitignore
'd (.gitignore
) - Add the
tslint.json
configuration extendingtslint-config-standard
(tslint.json
) - Write the definition, mirroring the original JavaScript source code with types (
index.d.ts
) - Make sure you include some tests for future contributors (
test.ts
) - Set up
.travis.yml
for CI (.travis.yml
) - Enable Greenkeeper and Travis CI
gem install travis
npm install -g greenkeeper
travis enable
greenkeeper enable
P.S. You should have the JavaScript source of the typings as a devDependency
, using the ~
or 1.0.x
version ranges. If Greenkeeper detects a new version, you'll have a chance to review the changes in a Pull Request.
sudo: false
language: node_js
notifications:
email:
on_success: never
on_failure: change
script:
- npm run lint
- npm run bundle
- npm rm tslint
- npm install $TYPESCRIPT --force
- npm run exec
env:
- TYPESCRIPT=typescript@1.8
- TYPESCRIPT=typescript@latest
- TYPESCRIPT=typescript@next
node_js:
- "stable"
The current practice for typing multiple versions in folders vs branches is undecided. The most obvious reason to target multiple branches over folders is supporting npm
natively. NPM can not install using folders.
{
"compilerOptions": {
"target": "es5",
"lib": ["es2015"],
"module": "commonjs",
"noEmit": true,
"noImplicitAny": true,
"strictNullChecks": true
}
}
For node typings, it also makes sense to use lib.core.d.ts
only. This enables people to disable browser typings without any issue.