As of TypeScript 2.0, typings is no longer required. The npm organization is an entity to setup a developers team. I believe Microsoft setup the @types organization in npm and added the TypeScript developer team to the organization. Packages on under the @types organization are published automatically from DefinitelyTyped using the types-publisher tool as per the docs.
In addition, to there is another way to add types
to your packages:
In your package.json
If your package has a main .js
file, you will need to indicate the main declaration file in your package.json
file as well. Set the types
property to point to your bundled declaration file. For example:
{
"name": "awesome",
"author": "Vandelay Industries",
"version": "1.0.0",
"main": "./lib/main.js",
"types": "./lib/main.d.ts"
}
Note that the "typings"
field is synonymous with "types"
, and could be used as well.
Also note that if your main declaration file is named index.d.ts
and lives at the root of the package (next to index.js
) you do not need to mark the "types"
property, though it is advisable to do so.
Regarding searching types
For the most part, type declaration packages should always have the same name as the package name on npm, but prefixed with @types/, but if you need, you can check out https://aka.ms/types to find the package for your favorite library.
From - http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html
But when I did npm search @types/openlayers
, I did not get any results. But doing the search from the web interface did return me the results. So I guess npm search
does not search across organizations.