Skip to content

ref: Refactor some more any types #14546

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

Merged
merged 4 commits into from
Dec 5, 2024
Merged

ref: Refactor some more any types #14546

merged 4 commits into from
Dec 5, 2024

Conversation

mydea
Copy link
Member

@mydea mydea commented Dec 3, 2024

Getting rid of some more any types.

@mydea mydea self-assigned this Dec 3, 2024
Copy link
Contributor

github-actions bot commented Dec 3, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.18 KB -0.05% -10 B 🔽
@sentry/browser - with treeshaking flags 21.85 KB -0.07% -14 B 🔽
@sentry/browser (incl. Tracing) 35.67 KB -0.05% -17 B 🔽
@sentry/browser (incl. Tracing, Replay) 72.58 KB -0.02% -13 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 63 KB -0.02% -12 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 76.88 KB -0.02% -13 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 89.37 KB -0.02% -12 B 🔽
@sentry/browser (incl. Feedback) 39.94 KB -0.03% -12 B 🔽
@sentry/browser (incl. sendFeedback) 27.79 KB -0.04% -10 B 🔽
@sentry/browser (incl. FeedbackAsync) 32.58 KB -0.03% -8 B 🔽
@sentry/react 25.86 KB -0.04% -9 B 🔽
@sentry/react (incl. Tracing) 38.49 KB -0.03% -9 B 🔽
@sentry/vue 27.39 KB -0.03% -7 B 🔽
@sentry/vue (incl. Tracing) 37.51 KB -0.03% -9 B 🔽
@sentry/svelte 23.34 KB -0.06% -13 B 🔽
CDN Bundle 24.34 KB -0.09% -20 B 🔽
CDN Bundle (incl. Tracing) 37.32 KB -0.04% -14 B 🔽
CDN Bundle (incl. Tracing, Replay) 72.2 KB -0.02% -13 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 77.54 KB -0.02% -11 B 🔽
CDN Bundle - uncompressed 71.54 KB -0.08% -58 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 110.82 KB -0.06% -58 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 223.89 KB -0.03% -58 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 237.11 KB -0.03% -58 B 🔽
@sentry/nextjs (client) 38.78 KB -0.05% -16 B 🔽
@sentry/sveltekit (client) 36.17 KB -0.03% -9 B 🔽
@sentry/node 152.11 KB +0.01% +5 B 🔺
@sentry/node - without tracing 99 KB +0.01% +7 B 🔺
@sentry/aws-serverless 144.02 KB +0.01% +7 B 🔺

View base workflow run

@mydea mydea requested review from lforst and Lms24 December 3, 2024 11:54
@mydea mydea marked this pull request as ready for review December 3, 2024 11:54
Copy link
Contributor

@lforst lforst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally lgtm but two places with weird gut feeling.

@@ -78,8 +78,7 @@ export class ServerRuntimeClient<
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public captureException(exception: any, hint?: EventHint, scope?: Scope): string {
public captureException(exception: unknown, hint?: EventHint, scope?: Scope): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be breaking in a weird way but I can't think of an example right now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be fine as accepting stuff as unknown like this will generally work for anything. The problematic part is replacing a return value of any with unknown, or with function args taking ...args: unknown[] vs ...args: any[].

Comment on lines +173 to +174
const colno = column;
const lineno = line;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: why are we removing the isNaN check here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it should not actually be needed, I think? window.onerror = function() should be supported everywhere in all the browser we support, and is typed consistently, so these should be proper numbers (or undefined) always?

@mydea mydea force-pushed the fn/refactor-some-more-any branch from 6d45ce7 to bc0b5d3 Compare December 5, 2024 13:28
@mydea mydea force-pushed the fn/refactor-some-more-any branch from bc0b5d3 to 11bcde2 Compare December 5, 2024 13:48
@mydea mydea merged commit 745775e into develop Dec 5, 2024
154 checks passed
@mydea mydea deleted the fn/refactor-some-more-any branch December 5, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants