FredrikOseberg / react-chatbot-kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Widgets Compiling with Problems in TypeScript

tanmayk92 opened this issue · comments

When adding a Component in Widgets in the config, It is showing error in browser. @FredrikOseberg

Type '{ botName: string; initialMessages: { loading: boolean; widget?: string | undefined; delay?: number | undefined; payload?: any; message: string; type: string; id: number; }[]; widgets: { widgetName: string; widgetFunc: () => JSX.Element; }[]; customStyles: { ...; }; customComponents: { ...; }; }' is not assignable to type 'IConfig'.
  Types of property 'widgets' are incompatible.
    Type '{ widgetName: string; widgetFunc: () => Element; }[]' is not assignable to type 'IWidget[]'.
      Type '{ widgetName: string; widgetFunc: () => Element; }' is missing the following properties from type 'IWidget': props, mapStateToProps

Just explore some files in the react-chatbot-kit. The properties are not optional and need to be used in the object, Can we change these properties to optional in the interface of IConfig and IWidget

Happy to accept a PR to improve the types @tanmayk92. Or you could share a reproducable example so I can take a look.