plausible / plausible-tracker

Frontend library to interact with Plausible Analytics
https://github.com/plausible/plausible-tracker
MIT License
214 stars 46 forks source link

Typescript build error TS2717 #66

Open brianhilst opened 3 months ago

brianhilst commented 3 months ago

Versions

Describe the bug

The following compile error occurs when running or building my React app with plausible-tracker installed :

ERROR in node_modules/plausible-tracker/src/lib/tracker.ts:7:5 TS2717: Subsequent property declarations must have the same type. Property 'plausible' must be of type 'TrackEvent', but here has type 'TrackEvent'.

 5 |   interface Window {
 6 |     // eslint-disable-next-line functional/prefer-readonly-type
 7 |     plausible: TrackEvent;
   |     ^^^^^^^^^
 8 |   }

tsconfig.json "skipLibCheck": true does not work for this because it is in a .ts file rather than a .d.ts file. I have not been able to find any work-around.

Expected behavior

Able to build

Steps to reproduce

Steps:

  1. Add this package to a typescript based React app
  2. yarn run (or build)
  3. ...

Your Environment

Additional context