You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where a sample `package.json` (anywhere next to or above a `tsconfig.json`) looks like:
96
-
```json
97
-
{
98
-
"name": "awesome",
99
-
"main": "./dist/foo.js",
100
-
"typescript": {
101
-
"definition": "awesome.d.ts"
102
-
}
103
-
}
104
-
```
105
-
106
-
We would generate a `awesome.d.ts` file for you *on build* so that other TypeScript projects can do a simple `require('awesome')`.
107
-
108
-
We have a sample NPM module : https://github.com/basarat/ts-npm-module and its usage is demoed in https://github.com/basarat/ts-npm-module-consume.
109
-
110
-
Notes:
111
-
* Relative paths in `definition` are not supported. This is due to a limitation in how the TypeScript compiler does file lookup.
112
-
* Other people will be able to do `require('awesome')` only if their IDE supports looking at `node_modules` like we do. Otherwise they can always explicitly `/// <reference` your `awesome.d.ts` that we generate to get the same effect.
94
+
## NPM Module Support
95
+
We have a sample NPM module : https://github.com/basarat/ts-npm-module (trick : in tsconfig have `"declaration" : true` an in package.json have a `typings` field pointing to the `main` file) and its usage is demoed in https://github.com/basarat/ts-npm-module-consume.
0 commit comments