TypeScript Error: Property 'track_pageview' does not exist on type 'OverridedMixpanel'. - v2.47.0
Hi, all!
I'm currently using React (^18.1.0) with TypeScript (^5.0.4) and mixpanel-browser (^2.47.0).
Using the new track_pageview() method in the latest release, however, I am encountering this TS error:
Property 'track_pageview' does not exist on type 'OverridedMixpanel'.
When I checked mixpanel/index.d.ts, it looks like the Mixpanel interface does not have the method signature defined for track_pageview().
I believe we can fix this issue for TS users by adding the method signature:
track_pageview(properties?: Dict): void
It looks like these are types from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mixpanel-browser/index.d.ts. That repo would probably be the right place to submit updates.
Same issue
Opened a new discussion on the DefinitelyTyped repo for this here: https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/65666
Same problem. I need a solution to track page view in browser...
Looks like this was already merged? https://github.com/DefinitelyTyped/DefinitelyTyped/pull/65672
But mixpanel needs to update mixpanel-browser version?
Looks like this was already merged? DefinitelyTyped/DefinitelyTyped#65672
But mixpanel needs to update mixpanel-browser version?
If the new types haven't been published yet, I'd guess that's something to take up with https://github.com/DefinitelyTyped/DefinitelyTyped
Same problem - this is over a year old now? What happened?
Aah wait I was doing this browser-side and instead of:
import mixpanel from "mixpanel";
I needed to do:
import mixpanel from "mixpanel-browser";
(and also add the types via npm install @types/mixpanel-browser
It still has a problem in 2.63.0 if import like import mixpanel from 'mixpanel-browser/src/loaders/loader-module-core' to reduce bundle size