While I loved both products, one problem was they didn't gel together nicely. However, this is no longer the cause with the new TypeScript 1.6 Beta!
As soon as I got it installed, I created a new
dropped in an example component, then saved the file. A standard
version of the React component. Awesome!
Then I tried to debug the project, and was greeted with this error:
Build: Cannot use JSX unless the '--jsx' flag is provided.
In the Text Editor \ TypeScript \ Project
General section of Visual Studio's Options dialog, I found an option for configuring the JSX emit mode, but this didn't seem to have any effect for the
tsx file in my project.
Next, I started poking around the
Microsoft.TypeScript.targets, I found the
<TypeScriptBuildConfigurations Condition="'$(TypeScriptJSXEmit)' != '' and '$(TypeScriptJSXEmit)' != 'none'">$(TypeScriptBuildConfigurations) --jsx $(TypeScriptJSXEmit)</TypeScriptBuildConfigurations>
Armed with that information I opened my
csproj file in trusty
Notepad++, and added the following
<PropertyGroup> <TypeScriptJSXEmit>react</TypeScriptJSXEmit> </PropertyGroup>
On reloading the project in Visual Studio, I found the build now
completed without raising an error, and it was correctly
generating the vanilla
Fantastic news, now I just need to convert my
jsx files to
tsx files and be happy!
- 2015-09-04 - First published
- 2020-11-21 - Updated formatting