Skip to content

Replace type assertions with type narrowing #1457

Open
@Ziwen510

Description

@Ziwen510

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or requestsecurityPull requests that address a security vulnerability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions