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

Replace type assertions with type narrowing #1457

Open
Ziwen510 opened this issue Jul 30, 2023 · 0 comments
Open

Replace type assertions with type narrowing #1457

Ziwen510 opened this issue Jul 30, 2023 · 0 comments
Labels
Enhancement New feature or request security Pull requests that address a security vulnerability

Comments

@Ziwen510
Copy link
Contributor

Ziwen510 commented Jul 30, 2023

Type assertions are everywhere in our code (eg. stepper/stepper.ts).

They defeat the point of having a type system by silencing the compiler on type errors. Type assertions only affect the static semantics of a program but not the dynamic semantics, meaning that even though the TypeScript compiler doesn't complain, our program could run into runtime type errors. Instead, we should make use of type narrowing.
See pull request #1453

image
@Ziwen510 Ziwen510 added the security Pull requests that address a security vulnerability label Jul 30, 2023
@martin-henz martin-henz added the Enhancement New feature or request label Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request security Pull requests that address a security vulnerability
Projects
None yet
Development

No branches or pull requests

2 participants