From 20283c6cda8ed5f57185302c6fc258ef263b90e0 Mon Sep 17 00:00:00 2001 From: PhilKunz Date: Mon, 18 Jan 2016 15:20:23 +0100 Subject: [PATCH] improve readme --- README.md | 11 +++++++++++ package.json | 3 ++- test/index.d.ts | 0 test/index.js | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/index.d.ts diff --git a/README.md b/README.md index 5a57e0c..56527d6 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,17 @@ Then use it in package.json's script section to trigger a build: by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to `./index.js` and `./test.js` +npmts also creates a index.d.ts declaration file. +You can reference it in your package.json like this: + +```json +"main": "index.js", +"typings": "./index.d.ts", +``` + +When requiring the module from other TypeScript files, +the TypeScript Compiler will use the declaration file to resolve typings. + #### Declaration files ### Custom behaviour diff --git a/package.json b/package.json index d8f079b..1292861 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,9 @@ "version": "1.0.4", "description": "write npm modules with TypeScript", "main": "index.js", + "typings": "./index.d.ts", "bin": { - "npmts": "index.js" + "npmts": "./index.js" }, "scripts": { "test": "(cd compile && node compile.js)", diff --git a/test/index.d.ts b/test/index.d.ts new file mode 100644 index 0000000..e69de29 diff --git a/test/index.js b/test/index.js index 91c0873..0ce6740 100644 --- a/test/index.js +++ b/test/index.js @@ -1,3 +1,5 @@ +#!/usr/bin/env node + (function () { console.log("test"); }());