diff --git a/types/nats-hemera/index.d.ts b/types/nats-hemera/index.d.ts index fe0476f780..791326df75 100644 --- a/types/nats-hemera/index.d.ts +++ b/types/nats-hemera/index.d.ts @@ -1,4 +1,13 @@ +// Type definitions for natsort 1.0 +// Project: https://github.com/hemerajs/hemera +// Definitions by: Melvin Groenhoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare module "nats-hemera" { + interface Hemera { + new (transport: object, config?: Config): CB; + } + type LogLevel = 'fatal' | 'error' | @@ -66,9 +75,7 @@ declare module "nats-hemera" { } - interface Hemera { - (transport: object, ): CB; - } + interface Pattern { topic: string; diff --git a/types/nats-hemera/nats-hemera-tests.ts b/types/nats-hemera/nats-hemera-tests.ts new file mode 100644 index 0000000000..d1bbb78fb1 --- /dev/null +++ b/types/nats-hemera/nats-hemera-tests.ts @@ -0,0 +1,17 @@ +import { Hemera } from 'nats-hemera'; + +const nats = {} + +const hemera: any = new Hemera(nats, {}); + + + +hemera.ready(() => { + + hemera.add({ + topic: 'math', + cmd: 'add' + }, function (req:any, cb: any) { + //.... + }) +}) \ No newline at end of file diff --git a/types/nats-hemera/tsconfig.json b/types/nats-hemera/tsconfig.json new file mode 100644 index 0000000000..367311d2f8 --- /dev/null +++ b/types/nats-hemera/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "nats-hemera-tests.ts" + ] +} diff --git a/types/nats-hemera/tslint.json b/types/nats-hemera/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/nats-hemera/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }