userback / widget-js

MIT License
4 stars 3 forks source link

TypeScript: UserbackWidgetSettings interface shipped with npm module is wrong / malformed. #23

Closed josheverett closed 2 years ago

josheverett commented 2 years ago

Interface in source:

image

Interface in the npm module's widget/dist/widget.d.ts file:

image

Notice the nested widgetSettings property.

As a result of this, the following makes TypeScript happy, but doesn't properly configure the widget:

<UserbackProvider
  token={TOKEN}
  widgetSettings={{ widgetSettings: { trigger_type: 'api' } }}
>
  ...
</UserbackProvider>

While TypeScript complains about this, but the widget is properly configured:

<UserbackProvider
  token={TOKEN}
  widgetSettings={{ trigger_type: 'api' }}
>
  ...
</UserbackProvider>
Shard commented 2 years ago

Hi @josheverett, Thank you for pointing out this issue to us!

There was a unreleased fix to this that I had not got around to publishing so i have cut a new v0.1.2 release to resolve this.

Let us know if your still having an issue with the types and we can re-open this issue, otherwise feel free to report any other issues you might have!

Cheers