Is there any difference between what the TypeScript spec calls a type assertion:
var circle = createShape(\"circle\");
And t
From Wiki page: "What's new in TypeScript [1.6]":
New
.tsxfile extension andasoperatorTypeScript 1.6 introduces a new
.tsxfile extension. This extension does two things: it enables JSX inside of TypeScript files, and it makes the newasoperator the default way to cast (removing any ambiguity between JSX expressions and the TypeScript prefix cast operator). For example:var x = <any> foo; // is equivalent to: var x = foo as any;
The difference is that as Circle works in TSX files, but <Circle> conflicts with JSX syntax. as was introduced for this reason.
For example, the following code in a .tsx file:
var circle = <Circle> createShape("circle");
Will result in the following error:
error TS17002: Expected corresponding JSX closing tag for 'Circle'.
However, as Circle will work just fine.
Use as Circle from now on. It's the recommended syntax.