Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update window types #75

Open
eluce2 opened this issue Apr 28, 2023 · 0 comments
Open

Update window types #75

eluce2 opened this issue Apr 28, 2023 · 0 comments
Assignees

Comments

@eluce2
Copy link

eluce2 commented Apr 28, 2023

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.

@walaszczykm walaszczykm self-assigned this Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants