📝 Edit on GitHub
Type assertions
Based on the docs
Below we convert from a string to a number.
As syntax
const foo = "this is a string";
const len = (foo as string).length;
Angle-bracket syntax
Does not work with JSX syntax.
const foo = "this is a string";
const len = (<string> foo).length;