botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[node.js] Missing score property on IPromptResult interface

Open JoseAntonioRodriguez opened this issue 10 years ago • 4 comments

Shouldn't the interface IPromptResult<T> (from botbuilder.d.ts) include the score: number; property?

JoseAntonioRodriguez avatar Oct 22 '16 17:10 JoseAntonioRodriguez

Why would it have a score?

Stevenic avatar Oct 27 '16 20:10 Stevenic

Well, I see that the IPromptResult<T> interface exported by the Prompts.ts file has such a property. Not sure whether that property is important from outside the framework but I'm extending the Prompts class to add some additional functionality and the compiler complains because the IPromptResult it sees from botbuilder.d.ts does not match the IPromptResult interface the Prompts class really uses. I've workarounded this by doing

declare module 'botbuilder' {
    interface IPromptResult<T> extends IDialogResult<T> {
        score: number;
    }
}

Which is the best strategy to extend the Prompts class? Another problem is that the sendPrompt method, which is very useful when extending this class, has been declared as private, so it is not visible from child classes.

JoseAntonioRodriguez avatar Oct 31 '16 08:10 JoseAntonioRodriguez

Oh I see... I forgot all about that. That was sort of a hack I needed to do to pass data back from the SimplePromptRecognizer. All of that code is eventually going to go away so I honestly wouldn't worry too much about it.

Can I ask what kind of functionality you're trying to add? The direction I'm moving in is to make prompts look and work more like the Custom Prompt example I recently published. If you're adding new prompts I'd suggest following that pattern instead,

Stevenic avatar Nov 02 '16 18:11 Stevenic

Closing as it appears we've addressed the question and haven't heard back on other scenarios. Please at-mention us or file a new issue if you'd like to discuss further. Thanks!

dandriscoll avatar Dec 26 '16 20:12 dandriscoll