analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Types for `@analytics/google-tag-manager`

Open borasemiz opened this issue 2 years ago • 3 comments

Hello,

The analytics package has built-in TypeScript types. It would be great if its plugin packages, like @analytics/google-tag-manager, have type declarations as well.

borasemiz avatar Jun 07 '23 07:06 borasemiz

I'm currently using this fallback:

declare module '@analytics/google-tag-manager' {
  import type { AnalyticsPlugin } from 'analytics';

  export interface GoogleTagManagerConfig {
    auth?: string;
    containerId: string;
    customScriptSrc?: string;
    dataLayerName?: string;
    debug?: boolean;
    execution?: string;
    preview?: string;
  }

  function googleTagManager(config: GoogleTagManagerConfig): AnalyticsPlugin;

  export default googleTagManager;
}

It might not be perfect, but it does help us for now.

grumpyoldman-io avatar Jul 12 '23 15:07 grumpyoldman-io

@borasemiz I had this issue, and followed the advice in this thread: https://github.com/DavidWells/analytics/issues/99#issuecomment-736153120

hsdonkin avatar Nov 06 '23 18:11 hsdonkin