Skip to content

Commit

Permalink
Add type definitions for docker-events (DefinitelyTyped#42217)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciffelia authored Feb 10, 2020
1 parent 5190cf1 commit 50b9bcf
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
13 changes: 13 additions & 0 deletions types/docker-events/docker-events-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as Dockerode from 'dockerode';
import * as DockerEvents from 'docker-events';

const emitter = new DockerEvents({
docker: new Dockerode(),
});

emitter.on('destroy', (message: object) => {
console.log('Container destroyed: %j', message);
emitter.stop();
});

emitter.start();
24 changes: 24 additions & 0 deletions types/docker-events/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Type definitions for docker-events 0.0
// Project: https://github.com/deoxxa/docker-events
// Definitions by: Ciffelia <https://github.com/ciffelia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="node" />

import * as events from 'events';
import * as Dockerode from 'dockerode';

declare namespace DockerEvents {
interface DockerEventsOptions {
docker: Dockerode;
}
}

declare class DockerEvents extends events.EventEmitter {
constructor(options?: DockerEvents.DockerEventsOptions);

start(): void;
stop(): void;
}

export = DockerEvents;
23 changes: 23 additions & 0 deletions types/docker-events/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"docker-events-tests.ts"
]
}
1 change: 1 addition & 0 deletions types/docker-events/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

0 comments on commit 50b9bcf

Please sign in to comment.