These are chat archives for jdubray/sam

Feb 2017
Fred Daoud
Feb 14 2017 00:24
@DrecDroid in codepen try clicking on Settings, then go to JavaScript, and under JavaScript Preprocessor, select TypeScript
Rodrigo Carranza
Feb 14 2017 00:29
For some reason It can't compile the entire program
Fred Daoud
Feb 14 2017 00:31
What does the console say? Any errors?
Is the typescript source on github or somewhere else?
Rodrigo Carranza
Feb 14 2017 00:32
No errors just, doesn't compile, here :, from line 173
No, I have not uploaded to github already
Fred Daoud
Feb 14 2017 00:34
thanks for sharing
later if I have a chance I'll take a look, maybe see why it's not running on codepen.
Rodrigo Carranza
Feb 14 2017 00:39
It is working now, apparently they're are using tsx Typescript flavor
so when I do type assertions using <Type> It crashes because It thinks It is React's jsx
From typescript site
The as operator
Recall how to write a type assertion:

   var foo = <foo>bar;
   Here we are asserting the variable bar to have the type foo. Since TypeScript also uses angle brackets for type assertions, JSX’s syntax introduces certain parsing      difficulties. As a result, TypeScript disallows angle bracket type assertions in .tsx files.

   To make up for this loss of functionality in .tsx files, a new type assertion operator has been added: as. The above example can easily be rewritten with the as   operator.

   var foo = bar as foo;
   The as operator is available in both .ts and .tsx files, and is identical in behavior to the other type assertion style.