Skip to content

Commit f3ebe24

Browse files
committed
Merge pull request alanhoff#8 from jabooth/ts-declaration
Add typescript declarations
2 parents 5d2c6ba + adeaa6a commit f3ebe24

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
!lib/**/*
44
!package.json
55
!index.js
6+
!index.d.ts
67
!LICENSE

index.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Type definitions for portastic v1.0.1
2+
// Project: portastic
3+
// Definitions by: James Booth github.com/jabooth
4+
5+
export function test(port: number, interface?: string, callback?: Function): Promise<boolean>
6+
7+
export function find(options: {min?: number, max?: number, retrieve?: number},
8+
interface?: string, callback?: Function): Promise<number[]>
9+
10+
export function filter(ports: number[], interface?: string, callback?: Function): Promise<number[]>
11+
12+
import { EventEmitter } from 'events'
13+
export class Monitor extends EventEmitter {
14+
constructor(ports: number[])
15+
on(event: "open" | "close", listener: (port: number) => void): this
16+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.1",
44
"description": "Pure javascript swiss knife for port management",
55
"main": "index.js",
6+
"types": "index.d.ts",
67
"scripts": {
78
"test": "mocha --tdd --bail test/**/*-test.js"
89
},
@@ -27,6 +28,7 @@
2728
},
2829
"homepage": "https://github.com/IchHabRecht/node-portastic#readme",
2930
"dependencies": {
31+
"@types/node": "0.0.2",
3032
"bluebird": "^2.9.34",
3133
"commander": "^2.8.1",
3234
"debug": "^2.2.0"

0 commit comments

Comments
 (0)