When comparing Haxe vs Typescript, the Slant community recommends Typescript for most people. In the question“What are the most enjoyable programming languages for web development? ” Typescript is ranked 3rd while Haxe is ranked 9th.
Ranked in these QuestionsQuestion Ranking
Pro Dead code elimination
Removes unused types and methods during transpilation.
Pro Access native features of target platform
Whenever you need to use target specific code (e.g. there is no Haxe library or extern definitions), you can embed fragments as untyped code in your Haxe code.
Pro Checks syntax at compile time
Pro Checks types at compile time
Pro Support multiple different platforms from one source
Pro Easy sharing of code accross multiple target platforms
Pro Provides an exit strategy for Flash developers through OpenFl
OpenFl is a library written in Haxe, that duplicates the Flash API, by providing a parallel implementation.
Haxe's syntax has a lot of similarities with Actionscript 3.
Flash developers can easily migrate their code to Haxe while still using and targeting Flash, in addition to unlocking all the new targets supported by Haxe / OpenFl.
Pro Checks syntax a compile time
Pro Checks types a compile time
Pro Developed and supported by a large company
Pro Huge collection of extern definitions
Pro Debugging in Typescript code through source maps
Con No conditional compilation
There is no support for conditional compilation where you can mark certain parts of your code that only get included in the final product when a compiler switch was set.
e.g. #if debug .... #end
However if your e.g. backend runs a different language, Typescript can't help you.
Con No Java-like package structure
Modules, namespaces and imports exist but they don't work like what people coming from Java development would expect
I've been using Typescript for quite some time now, and I'm still not sure I fully understand them.