We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
We are running into an issue for users that have ad blocking or cross-site tracking disabled.
Our code:
import type { AnalyticsSnippet } from '@segment/analytics-next'; const getAnalytics = (): AnalyticsSnippet | undefined => typeof window !== 'undefined' ? window.analytics : undefined; getAnalytics()?.user()
Throws the error:
VM70:1 Uncaught TypeError: analytics.user is not a function at <anonymous>:1:11
My expectation is that the typescript definition lists the user function as optionally undefined so that typescript enforces that we call the code as:
getAnalytics()?.user?.()
This would prevent us from running into runtime errors for users with ad blockers or cross site trackers disabled.
We are using @segment/[email protected] & [email protected]
@segment/[email protected]
[email protected]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
We are running into an issue for users that have ad blocking or cross-site tracking disabled.
Our code:
Throws the error:
My expectation is that the typescript definition lists the user function as optionally undefined so that typescript enforces that we call the code as:
This would prevent us from running into runtime errors for users with ad blockers or cross site trackers disabled.
We are using
@segment/[email protected]
&[email protected]
The text was updated successfully, but these errors were encountered: