Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Typescript Declaration #953

Merged
merged 4 commits into from
Aug 29, 2017
Merged

Typescript Declaration #953

merged 4 commits into from
Aug 29, 2017

Conversation

uny
Copy link
Contributor

@uny uny commented Aug 11, 2017

Revised version of #494.
I checked that this declaration file passed the examples on https://github.com/howdyai/botkit/tree/master/examples.

* 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
Copy link
Contributor

@Naktibalda Naktibalda left a 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;
Copy link
Contributor

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.

botkit.middleware = {

Copy link
Contributor Author

@uny uny Aug 15, 2017

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.

@Naktibalda
Copy link
Contributor

Thanks, I don't get any type errors anymore, but I get a runtime error TypeError: Cannot read property 'consolebot' of undefined.

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;
Copy link
Contributor Author

@uny uny Aug 15, 2017

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');

@Naktibalda
Copy link
Contributor

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.

@uny
Copy link
Contributor Author

uny commented Aug 17, 2017

@Naktibalda

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.
Is this okay? b9800bc

@Naktibalda
Copy link
Contributor

I expected to see more types, but it is okay.

@benbrown I think that this PR is good to merge.

@benbrown benbrown merged commit b9800bc into howdyai:master Aug 29, 2017
@uny uny deleted the feature/types branch August 30, 2017 02:24
@aaronsky
Copy link

nice work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants