analytics
analytics copied to clipboard
TypeScript support for analytics-plugin-do-not-track
Similar to https://github.com/DavidWells/analytics/issues/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.
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? 😃
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.
...
});
Yeah so to use this library with the analytics
library, it needs types.
Not sure how to add types here for this.
Maybe this belongs in https://github.com/DefinitelyTyped/DefinitelyTyped ?
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