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

front: replace some type assertions with non-null assertions #8822

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

emersion
Copy link
Member

In general I prefer to avoid as type assertions as much as possible, because it makes the compiler ignore any type mismatch. The non-null assertion operator ! is a bit better: if the types don't match, the compiler will error out.

Use it in a bunch of places.

See #8698 (comment)

@emersion emersion requested a review from a team as a code owner September 10, 2024 16:16
@emersion emersion force-pushed the emr/drop-type-asserts branch from bad1972 to 407ab23 Compare September 10, 2024 16:40
@emersion emersion self-assigned this Sep 10, 2024
Copy link
Contributor

@SharglutDev SharglutDev left a comment

Choose a reason for hiding this comment

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

Lgtm (just one question comment)

@emersion emersion force-pushed the emr/drop-type-asserts branch from 407ab23 to e9ac63b Compare September 13, 2024 08:30
Copy link
Contributor

@SarahBellaha SarahBellaha left a comment

Choose a reason for hiding this comment

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

Lgtm

@emersion emersion force-pushed the emr/drop-type-asserts branch from e9ac63b to 1386ba8 Compare September 16, 2024 09:40
In general I prefer to avoid `as` type assertions as much as
possible, because it makes the compiler ignore any type mismatch.
The non-null assertion operator `!` is a bit better: if the types
don't match, the compiler will error out.

Use it in a bunch of places.

See #8698 (comment)
@emersion emersion force-pushed the emr/drop-type-asserts branch from 1386ba8 to e6a7912 Compare September 16, 2024 12:26
@emersion emersion enabled auto-merge September 16, 2024 12:27
@emersion emersion added this pull request to the merge queue Sep 16, 2024
Merged via the queue into dev with commit f210693 Sep 16, 2024
23 checks passed
@emersion emersion deleted the emr/drop-type-asserts branch September 16, 2024 12:50
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.

3 participants