From be064f6e2f98d29d5af2e3eecfbadaaa3a193c73 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 20:57:06 -0700 Subject: [PATCH] Add rudimentary `hubot` type definitions --- types/hubot/index.d.ts | 53 +++++++++++++++++++++++++++++++++++++++ types/hubot/tsconfig.json | 21 ++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 types/hubot/index.d.ts create mode 100644 types/hubot/tsconfig.json diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts new file mode 100644 index 0000000000..6e81398a33 --- /dev/null +++ b/types/hubot/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for hubot 2.19.0 +// Project: https://hubot.github.com +// Definitions by: Dirk Gadsden +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'hubot' { + interface Brain { + userForId: (id: any) => any + } + + interface User { + id: any + name: string + } + + interface Message { + user: User + text: string + id: string + } + + interface Response { + match: RegExpMatchArray + message: Message + send: (...strings: string[]) => void + reply: (...strings: string[]) => void + random: (items: T[]) => T + } + + interface ListenerCallback { + (response: Response): void + } + + interface HearWithOptions { + (regex: RegExp, options: any, callback: ListenerCallback): void + } + interface HearWithoutOptions { + (regex: RegExp, callback: ListenerCallback): void + } + + interface RespondWithOptions { + (regex: RegExp, options: any, callback: ListenerCallback): void + } + interface RespondWithoutOptions { + (regex: RegExp, callback: ListenerCallback): void + } + + export interface Robot { + brain: Brain + hear: HearWithOptions & HearWithoutOptions + respond: RespondWithOptions & RespondWithoutOptions + } +} diff --git a/types/hubot/tsconfig.json b/types/hubot/tsconfig.json new file mode 100644 index 0000000000..7a0988e344 --- /dev/null +++ b/types/hubot/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +}