Skip to content
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

feat(types): Add type for measurement unit #5313

Merged
merged 1 commit into from Jun 27, 2022
Merged

Conversation

AbhiPrasad
Copy link
Member

Folks gave some feedback that we should be explicit about the units we
support. Let's add TypeScript types for these so we don't add any
runtime logic, but it should have helpful autocomplete for users.

cc @k-fish who brought this up with getsentry/sentry#36012

Folks gave some feedback that we should be explicit about the units we
support. Let's add TypeScript types for these so we don't add any
runtime logic, but it should have helpful autocomplete for users.
@AbhiPrasad AbhiPrasad requested review from lforst and Lms24 June 24, 2022 18:20
@@ -50,7 +50,7 @@ function _trackCLS(): void {
}

__DEBUG_BUILD__ && logger.log('[Measurements] Adding CLS');
_measurements['cls'] = { value: metric.value, unit: 'none' };
_measurements['cls'] = { value: metric.value, unit: '' };
Copy link
Member Author

Choose a reason for hiding this comment

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

'none' === '' here, but this saves us some bytes.

Copy link
Member

@k-fish k-fish left a comment

Choose a reason for hiding this comment

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

Appreciate it 👍 this makes it far easier to use without looking things up.

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.3 KB (added)
@sentry/browser - ES5 CDN Bundle (minified) 59.72 KB (added)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.9 KB (added)
@sentry/browser - ES6 CDN Bundle (minified) 52.67 KB (added)
@sentry/browser - Webpack (gzipped + minified) 19.67 KB (added)
@sentry/browser - Webpack (minified) 64.04 KB (added)
@sentry/react - Webpack (gzipped + minified) 19.69 KB (added)
@sentry/nextjs Client - Webpack (gzipped + minified) 43.85 KB (added)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.63 KB (added)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 23.9 KB (added)

@AbhiPrasad AbhiPrasad merged commit 446a295 into master Jun 27, 2022
@AbhiPrasad AbhiPrasad deleted the abhi-measurement-unit branch June 27, 2022 15:35
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.

None yet

3 participants