I just start working on a React project with TypeScript and ask myself what should I do with regular class files? Should I use .ts or .tsx files an
.ts files have an type assertion syntax which conflicts with the JSX grammar. In order to avoid breaking a ton of people, we use .tsx for JSX, and added the foo as Bar syntax which is allowed in both .ts and .tsx files.
let someValue: any = "this is a string";
let strLength: number = (someValue).length;
And the other is the as-syntax:
let someValue: any = "this is a string";
let strLength: number = (someValue as string).length;
We can use .ts with as-syntax but is cool!