actions-on-google-nodejs
actions-on-google-nodejs copied to clipboard
TypeScript Proposal: Default types for TConvData and TUserStorage should be defined
Issue #188 illustrates a general problem with assigning properties to the default TConvData type. TUserStorage appears to have the same problem based on this StackOverflow question. The issue is that the definition of DialogflowConversation defines these as type {}, and TypeScripts type checking doesn't allow for properties that aren't defined.
The TypeScript Handbook seems to suggest that creating an interface that explicitly allows any property of any type is a way to work around this issue
interface GenericStorage {
[propName: string]: any;
}
I agree
Originally, it was intended to be empty by default to make developers have to define their own types for stricter type control.
But maybe it makes more sense to provide convenience first and have developers optionally make their types stricter.
We can take a look at this again and possibly change the behavior.
This has been fixed and can be closed. JsonObject is used as default type (see src/dialogflow/conv.ts)