Replies: 1 comment
-
As per a @kamilogorek knowledge bomb on slack:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
getGlobalObject
seems to be overused throughout the SDKs. Why not usewindow
in@sentry/browser
andglobal
in@sentry/node
? What context/knowledge am I missing?getGlobalObject
was clearly designed to help get the global object when the code might be run on different runtimes (ie. frontend and backend) but those usages are minimal.In many cases, it appears to be used to help extend the global type like this:
sentry-javascript/packages/nextjs/src/performance/client.ts
Lines 14 to 20 in 903addf
sentry-javascript/packages/nextjs/src/performance/client.ts
Line 202 in 903addf
But you can extend the global via
declare global
so the types work and simply usewindow
:Do we avoid using
declare global
for the below global properties because this leaks into the global type for consumers of the SDKs?sentry-javascript/packages/utils/src/global.ts
Lines 13 to 27 in 903addf
Beta Was this translation helpful? Give feedback.
All reactions