Add rudimentary hubot type definitions

This commit is contained in:
Dirk Gadsden
2017-06-10 20:57:06 -07:00
parent 3b2f53cf6a
commit be064f6e2f
2 changed files with 74 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
// Type definitions for hubot 2.19.0
// Project: https://hubot.github.com
// Definitions by: Dirk Gadsden <https://github.com/dirk>
// 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: <T>(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
}
}
+21
View File
@@ -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"
]
}