Replace type assertions with type narrowing
Ziwen510 opened this issue · 0 comments
Ziwen510 commented
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