mixpanel-js icon indicating copy to clipboard operation
mixpanel-js copied to clipboard

TypeScript Error: Property 'track_pageview' does not exist on type 'OverridedMixpanel'. - v2.47.0

Open beforeoafterm opened this issue 1 year ago • 7 comments

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'.
Screenshot 2023-05-31 at 1 11 30 PM

When I checked mixpanel/index.d.ts, it looks like the Mixpanel interface does not have the method signature defined for track_pageview().

Screenshot 2023-05-31 at 1 14 42 PM

I believe we can fix this issue for TS users by adding the method signature:

track_pageview(properties?: Dict): void

beforeoafterm avatar May 31 '23 05:05 beforeoafterm