-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Sentry typescript type error introduced in 7.16.0 #6016
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
Comments
This is occuring because we have top level casting for @timfish could we move these exports into the browser package to fix this? |
ref #5831 |
I guess the only option is to put it behind a function call for now? export function WINDOW(): Window & InternalGlobal {
return GLOBAL_OBJ as Window & InternalGlobal;
} |
We'll probably have to cast at call site because top level call will still break TS definitions. Why can't we move the |
Earlier we had this code in utils with no issues: sentry-javascript/packages/utils/src/global.ts Lines 36 to 46 in 4cc07f6
So |
Yeah
I think the issue here is that a top level def of |
Yeah, it doesn't need to be exported and can be used only internally in utils |
Oh, that is not the case since we can't keep Do you think a generic will work with a default type? export function WINDOW<T = Window>(): InternalGlobal & T {
return GLOBAL_OBJ as InternalGlobal & T;
} |
I don't think so.
We can still keep it as long as it's within a function call right? We don't have to use the default generic, just leave it as |
I am getting this error in Production and need help fixing it as soon as possible: const WINDOW = GLOBAL_OBJ ; export { WINDOW }; "@sentry/react": "^7.44.2", |
@dgesteves this is a different issue. Please open a new one. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/serverless
SDK Version
7.16.0
Framework Version
Serverless
Link to Sentry event
No response
Steps to Reproduce
For my GCP serverless codebase,
Nodejs v16.13.2
Typescript 4.8.3
if I upgrade my sentry packages from 7.15.0 to 7.16.0, it gives error
Expected Result
No error
Actual Result
The text was updated successfully, but these errors were encountered: