Google News
logo
TypeScript - Interview Questions
What is "as" syntax in TypeScript?
The as is the additional syntax for Type assertion in TypeScript. The reason for introducing the as-syntax is that the original syntax (<type>) conflicted with JSX.
 
Example :
let empCode: any = 111;     
let employeeCode = code as number;​
When using TypeScript with JSX, only as-style assertions are allowed.
Advertisement