Skip to content

Commit

Permalink
[[FIX]] Default export is not working at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseAntonioRodriguez committed Sep 1, 2016
1 parent 19fb38d commit 52e5d10
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ server.terminate(function(err, terminatedByTimeout) {
Or if you are using TypeScript:
```typescript
import * as http from 'http';
import enableTerminate from 'server-terminate';
import enableTerminate = require('server-terminate');

let server: http.Server = http.createServer(function onRequest(req: http.ServerRequest, res: http.ServerResponse) {
// Do your stuff here
Expand Down
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as http from 'http';

export default function enableTerminate(server: http.Server, opts?: Options): http.Server;
declare function enableTerminate(server: http.Server, opts?: Options): http.Server;
export = enableTerminate;

interface Options {
timeout?: number;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
],
"main": "index",
"scripts": {
"lint": "eslint index.js test/*.js && tslint index.d.ts test/*.ts",
"test": "tartare test/*.spec.js && tsc",
"lint": "eslint index.js test/*.spec.js && tslint index.d.ts test/*.ts",
"test": "tartare test/*.spec.js && tsc && node test/server-terminate.typings.js",
"changelog": "conventional-changelog --preset jshint --infile CHANGELOG.md --same-file",
"changelog-gh-release": "conventional-changelog --preset jshint --config .changelog.js",
"release": "release-it"
Expand Down
3 changes: 2 additions & 1 deletion test/server-terminate.typings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as http from 'http';
import enableTerminate from '../';
import enableTerminate = require('../');

let server: http.Server = http.createServer(function onRequest(req: http.ServerRequest, res: http.ServerResponse) {
res.writeHead(200);
Expand All @@ -12,4 +12,5 @@ server.listen(8080);

server.terminate((err, terminatedByTimeout) => {
// You get here when all connections have been closed
console.log('Server terminated. terminatedByTimeout:', terminatedByTimeout); // tslint:disable-line no-console
});
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"noImplicitAny": false,
"sourceMap": false,
"moduleResolution": "node",
"pretty": true,
"noEmit": true
"pretty": true
},
"exclude": [
"node_modules"
Expand Down

0 comments on commit 52e5d10

Please sign in to comment.