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

fix(analytics-types): update Element in element interactions #877

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/analytics-types/src/element-interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface ElementInteractionsOptions {
* @param actionType - The type of action that triggered the event.
* @param element - The [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) that triggered the event.
*/
shouldTrackEventResolver?: (actionType: ActionType, element: Element) => boolean;
shouldTrackEventResolver?: (actionType: ActionType, element: DomElement) => boolean;

/**
* Prefix for data attributes to allow auto collecting.
Expand Down Expand Up @@ -91,9 +91,9 @@ export interface Messenger {
setup: () => void;
}

// The [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) type is used when the dom library is included in tsconfig.json
// This interface is for packages without the dom library, for example, analytics-node
interface Element {
id: string;
className: string;
}
// DomElement is [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) if the dom library is included in tsconfig.json
// and never if it is not included
// eslint-disable-next-line no-restricted-globals
type DomElement = typeof globalThis extends { Element: infer T extends abstract new (...args: any) => any }
? InstanceType<T>
: never;
Loading