Skip to content

ref(type-guards): narrow down the type #4278

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 2 commits into from
Dec 15, 2021
Merged

ref(type-guards): narrow down the type #4278

merged 2 commits into from
Dec 15, 2021

Conversation

JonasBa
Copy link
Member

@JonasBa JonasBa commented Dec 14, 2021

Improve the type guards

@JonasBa JonasBa requested a review from AbhiPrasad December 14, 2021 13:00
@@ -103,7 +103,7 @@ function getWalkSource(
currentTarget?: unknown;
}

const event = value as SimpleEvent;
const event = (value as unknown) as SimpleEvent;
Copy link
Member Author

Choose a reason for hiding this comment

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

The types overlap, TS now properly warns us about it, so we need to cast to unknown first

@github-actions
Copy link
Contributor

github-actions bot commented Dec 14, 2021

size-limit report

Path Base Size (f32cd36) Current Size Change
@sentry/browser - CDN Bundle (gzipped) 21.39 KB 21.39 KB +0.02% 🔺
@sentry/browser - CDN Bundle (minified) 69.89 KB 69.9 KB +0.01% 🔺
@sentry/browser - Webpack 23.15 KB 23.15 KB 0%
@sentry/browser - Webpack - gzip = false 81.05 KB 81.05 KB 0%
@sentry/react - Webpack 23.19 KB 23.19 KB 0%
@sentry/nextjs Client - Webpack 47.77 KB 47.77 KB 0%
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 29.69 KB 29.69 KB +0.01% 🔺

@AbhiPrasad AbhiPrasad added this to the Treeshaking / Bundle Size milestone Dec 14, 2021
@AbhiPrasad
Copy link
Member

We typically will use the package name as the scope, so this would be ts(utils) or ref(utils):

@JonasBa JonasBa changed the title ts(type-guards): narrow down the type ref(type-guards): narrow down the type Dec 15, 2021
@JonasBa JonasBa enabled auto-merge (squash) December 15, 2021 07:50
@JonasBa JonasBa merged commit 0f49c02 into master Dec 15, 2021
@JonasBa JonasBa deleted the jb/utils/guards branch December 15, 2021 08:36
onurtemizkan pushed a commit that referenced this pull request Dec 19, 2021
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.

2 participants