sentry
sentry copied to clipboard
fix(ts): Remove non-null assertion in integrationExternalUserMappings.tsx
Goal
The goal of this PR is to get rid of a non-null assertion (!
) following an optional chaining operator (?.
):
https://github.com/getsentry/sentry/blob/3e90887a3632585b048f607668e20927321a39a0/static/app/views/settings/organizationIntegrations/integrationExternalUserMappings.tsx#L105-L112
Optional chain expressions are designed to return undefined
if the optional property is nullish. Using a non-null assertion after an optional chain expression doesn't make logical sense and introduces a type safety hole into the code.
Approach
We get rid of the non-null assertion and simply allow the id
string to be undefined
in the return value of the sentryNamesMapper
prop passed down to the <IntegrationExternalMappings />
child component.
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
Codecov Report
Attention: Patch coverage is 0%
with 1 lines
in your changes are missing coverage. Please review.
Project coverage is 79.91%. Comparing base (
3e90887
) to head (dd2b38e
).
Additional details and impacted files
@@ Coverage Diff @@
## master #70307 +/- ##
==========================================
+ Coverage 76.92% 79.91% +2.98%
==========================================
Files 6673 6503 -170
Lines 298101 289883 -8218
Branches 49918 49918
==========================================
+ Hits 229320 231654 +2334
+ Misses 68158 57817 -10341
+ Partials 623 412 -211
Files | Coverage Δ | |
---|---|---|
...ionIntegrations/integrationExternalMappingForm.tsx | 92.85% <ø> (ø) |
|
...onIntegrations/integrationExternalUserMappings.tsx | 0.00% <0.00%> (ø) |