I use original Javascript function
function gtag(){dataLayer.push(arguments);}
then got error: error TS2554: Expected 0 arguments, but got 3. when used like this:
gtag('event', 'page_view', { send_to: 'xxxx' })
I used // @ts-ignore as a workaround and it works: I see traffic in Google analytics. I want to do it properly without workarounds and I tried to replace gtag function like this:
function gtag(...args: any) {
window.dataLayer.push(args)
}
and some other variants but it did not work. I see that window.dataLayer items now contain array instead of Object or Arguments.
Or better is there some existing gtag wrapper something similar to react-gtm or react-ga but for gtagjs?