Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using pageTrackerSkipSamePath option - types don't match #535

Open
mrchimp opened this issue Apr 24, 2023 · 2 comments
Open

Error when using pageTrackerSkipSamePath option - types don't match #535

mrchimp opened this issue Apr 24, 2023 · 2 comments

Comments

@mrchimp
Copy link

mrchimp commented Apr 24, 2023

Environment *

Run this command in the project folder and fill in their results:

npm ls vue-gtag:

[email protected] /home/mrchimp/code/project
└── [email protected]

npm ls vue:

[email protected] /home/mrchimp/code/project
├─┬ [email protected]
└─┬ [email protected]
  └── [email protected] deduped

Then, specify:

  1. Operating system: Ubuntu 22.04.2
  2. Browser and version: n/a

Description *

I am seeing a type error when trying to use the pageTrackerSkipSamePath option in TypeScript, like so:

app.use(
  VueGtag,
  {
    pageTrackerSkipSamePath: false, // This is line 34
    config: { id: import.meta.env.VITE_GA },
  },
  router
);

Expected behavior

Compile without error.

Actual behavior

I get an error:

src/main.ts:34:5 - error TS2345: Argument of type '{ pageTrackerSkipSamePath: boolean; config: { id: any; }; }' is not assignable to parameter of type 'PluginOptions'.
  Object literal may only specify known properties, and 'pageTrackerSkipSamePath' does not exist in type 'PluginOptions'.

34     pageTrackerSkipSamePath: false,

Further Info

It seems that the options don't match up with the type definition.

@jimmiejackson
Copy link

The same thing is happening when I'm trying to use pageTrackerExcludedRoutes, and doesn't appear to be actually excluding routes either.

@Stevie-Ray
Copy link

As a quick workaround, you can use

declare module 'vue-gtag' {
  interface PluginOptions {
    pageTrackerSkipSamePath?: boolean;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants