TypeScript | TypeScript Functions | Question9

Last Updated :
Discuss
Comments

How does type assertion work in TypeScript when casting?

It allows you to tell TypeScript to treat a variable as a more specific type.

It performs a runtime conversion of types.

It enforces the variable to always be of the asserted type.

It helps in creating custom type aliases.

Share your thoughts in the comments