Skip to content

Update window types #75

@eluce2

Description

@eluce2

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @livechat/widget-core@1.3.0 for the project I'm working on.

I noticed that you included the types for the widget in your package, but they were not applying for me in my Next.js app. I'm using version 4.9.5 of Typescript.

Here is the diff that solved my problem:

diff --git a/node_modules/@livechat/widget-core/dist/widget-core.d.ts b/node_modules/@livechat/widget-core/dist/widget-core.d.ts
index a30da32..551784c 100644
--- a/node_modules/@livechat/widget-core/dist/widget-core.d.ts
+++ b/node_modules/@livechat/widget-core/dist/widget-core.d.ts
@@ -1,4 +1,5 @@
-declare type ExtendedWindow = Window & {
+ declare global{
+ interface Window  {
     __lc: {
         license: number;
         group?: number;
@@ -21,7 +22,8 @@ declare type ExtendedWindow = Window & {
     LC_API?: {
         on_after_load?: VoidFunction;
     };
-};
+}
+ }
 declare function on(name: 'ready', handler: EventHandlers['onReady']): void;
 declare function on(name: 'new_event', handler: EventHandlers['onNewEvent']): void;
 declare function on(name: 'form_submitted', handler: EventHandlers['onFormSubmitted']): void;

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions