-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript Declaration #953
Conversation
* d.ts * Conversation * slack * slack * cisco spark * storage & logger * remove others * example slack * facebook * studio * twilio * bot framework * rm lib/_Botkit.d.ts * package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add middleware property to Controller interface.
on(event: string, cb: HearsCallback<S, M, B>): this; | ||
setupWebserver(port: number | string, cb: (err: Error, webserver: any) => void): this; | ||
spawn(config?: S, cb?: (worker: B) => void): B; | ||
startTicking(): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
middleware property is not declared in Controller.
Line 42 in aeb1b02
botkit.middleware = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I did in 97fd4d0.
Thanks, I don't get any type errors anymore, but I get a runtime error Compiled code looks like this: var botkit_1 = require("botkit");
var bot_options = {
json_file_store: __dirname + '/../.data/db/'
};
// Create the Botkit controller, which controls all instances of the bot.
var controller = botkit_1.default.consolebot(bot_options); |
type SlackWebAPIMethod = (data: any, cb: (err: Error, response: any) => void) => void; | ||
} | ||
|
||
export = botkit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Naktibalda Thank you for your review.
It is my mistake.
5951c74
Please import the module as below:
import Botkit = require('botkit');
Thanks, it works now. Could you add at least one example file converted to Typescript? I was going to ask you to add dtslint to CI configuration, but I just noticed that botkit has no CI. |
Sure. |
I expected to see more types, but it is okay. @benbrown I think that this PR is good to merge. |
nice work! |
Revised version of #494.
I checked that this declaration file passed the examples on https://github.com/howdyai/botkit/tree/master/examples.