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

TypeScript support for analytics-plugin-do-not-track #134

Closed
saiichihashimoto opened this issue Jan 6, 2021 · 5 comments
Closed

TypeScript support for analytics-plugin-do-not-track #134

saiichihashimoto opened this issue Jan 6, 2021 · 5 comments

Comments

@saiichihashimoto
Copy link

Similar to #99, there aren't types for analytics-plugin-do-not-track. I don't want to add the types to https://github.com/DefinitelyTyped/DefinitelyTyped when there's some level of typescript support in some of the projects.

@DavidWells
Copy link
Owner

Looks like there are no options for this plugin. https://github.com/DavidWells/analytics/blob/master/packages/analytics-plugin-do-not-track/src/index.js

It just uses the browser do not track settings.

So I guess no types are needed? 😃

@saiichihashimoto
Copy link
Author

import { Analytics } from 'analytics';
import doNotTrackPlugin from 'analytics-plugin-do-not-track';

Analytics({
  plugins: [doNotTrackPlugin()], // <<< This gets mad because `doNotTrackPlugin` has no type and `Analytics` is expecting a plugin type.
  ...
});

@saiichihashimoto
Copy link
Author

Yeah so to use this library with the analytics library, it needs types.

@DavidWells
Copy link
Owner

Not sure how to add types here for this.

Maybe this belongs in https://github.com/DefinitelyTyped/DefinitelyTyped ?

@saiichihashimoto
Copy link
Author

Is there a way to export in the package:

declare module 'analytics-plugin-do-not-track' {
	import type { AnalyticsPlugin } from 'analytics';

	export default function doNotTrackPlugin(): AnalyticsPlugin;
}

Because that's all it is

@saiichihashimoto saiichihashimoto closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2023
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

2 participants