-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Need a way to obtain webchat.d.ts file #2100
Comments
Would prefer to write it manually because:
|
please find this d.ts code as a starter. I just added the ones needed for me, feel free to take it, improve it and make a PR out of it. Use it from your .ts with: import 'typings/WebChat' //you'll need to adjust this to your own setup interface Window {
WebChat: WebChat.IWebChat;
}
declare namespace WebChat {
interface IWebChat {
createStore(): IStore,
renderWebChat(options: IWebChatOptions, element: HTMLElement): void,
createDirectLine(tokenData: IDirectLineToken): IDirectLine
}
interface IDirectLineToken {
token: string
}
interface IWebChatOptions {
directLine: IDirectLine,
store: IStore,
styleOptions: IStyleOptions
}
interface IStyleOptions {
[index: string]: number | string | boolean;
botAvatarInitials: string,
botAvatarBackground: string,
botAvatarImage: string,
bubbleBorderRadius: string,
bubbleTextColor: string,
bubbleFromUserBackground: string,
bubbleFromUserTextColor: string,
bubbleFromUserBorderRadius: string,
hideUploadButton: boolean
}
interface IDirectLine { }
interface IDispatchPayload {
text: string
}
interface IDispatchAction {
type: string,
payload: IDispatchPayload
}
interface IStore {
dispatch(action: IDispatchAction)
}
} |
@corinagum will implement the initial .d.ts file. As a team we'll think about a way to automatically generate this file with a level of control over the exposed interface that we want. |
That's great to hear :) I just wanted to contribute something for the time being since it is unclear when it will be implemented by the webchat team? |
@cwhitten @corinagum Could you please give some more insight into when we can expect this? |
@hansmbakker, thanks for your patience! This is assigned to me in our current milestone 4.6, which is due for release at the end of October. I am finishing up some other assignments first, but I hope to get to this one soon! Unfortunately I don't have further detail than that right now. When I begin working on this, I will move it from 'To-Do' to 'In progress' in our Project board. :) |
I am okay to inference the types automatically, as long as:
We can progressively add typings, I think the most needed is FYI, our project already have TypeScript set up through Babel. |
Discussed offline with @corinagum, we will try this route:
|
Need a way to get access to webchat.d.ts file.
I tried building the repo, but it generates multiple d.ts files, and consolidating them is painful. It's really helpful in writing typescript code. Please provide a way to get it, either directly from cdn or by building the code.
The text was updated successfully, but these errors were encountered: