4lejandrito / next-plausible

Simple integration for https://nextjs.org and https://plausible.io analytics
https://next-plausible.vercel.app
MIT License
603 stars 33 forks source link

v3.12.1 throws type error and breaks existing `usePlausible` hook #128

Closed mfts closed 3 months ago

mfts commented 3 months ago

in v3.12.0:

const plausible = usePlausible();
plausible("clickEvent")

with this type:

const plausible: <"clickEvent">(eventName: "clickEvent", ...rest: [] | [(Omit<EventOptions<never>, "props"> | undefined)?] | [EventOptions<any>]) => any

in v3.12.1:

const plausible = usePlausible();
plausible("clickEvent")

with this type:

const plausible: <"clickEvent">(eventName: "clickEvent", rest_0: EventOptions<any>) => any

and therefore the following type error

Expected 2 arguments, but got 1.ts(2554)
usePlausible.d.ts(14, 99): Arguments for the rest parameter 'rest' were not provided.
4lejandrito commented 3 months ago

Hey @mfts thanks for reporting this. You are right.

I will fix it soon.

4lejandrito commented 3 months ago

Published as next-plausible@13.12.2.