5 ms·
I started out using Haxe and eventually switched to Typescript because: - it didn't easily integrate with existing JS code/libraries - small community - low
by agd 11y ago
I started out using Haxe and eventually switched to Typescript because:
- it didn't easily integrate with existing JS code/libraries
- small community
- low resources (compiler bugs existed and weren't quickly fixed)
The community was a dealbreaker really. Lots of JS libraries already have TS type definitions so it's easy to get started, and TS keeps up-to-date with new JS features.
I prefered the Haxe typesystem, but it didn't really make business sense to keep using it.
- enriquecastl 11y agoThe first point applies to TypeScript too. It's hard to integrate a library that doesn't have a type definition or don't play well with its module system. This week I started to work on a Node hobby project and decided to use TypeScript. I rolled back my decision after noticing that it was not possible to include installed node npm modules using the ES6 syntax. They'll probably fix this issue sooner rather than later but in the meanwhile it's a critical issue.
- Glide 11y agoWait.. Are you talking about what's described here: https://github.com/Microsoft/TypeScript/issues/2242 https://github.com/Microsoft/TypeScript/issues/2242 I just did a small typescript prototype and used the import syntax there. It might have been your typescript version as 1.5 recently came out (and I was using the 1.5 beta 2). The hardest part is what you described at the start. If it doesn't have a type definition it's hard. DefinitelyTyped helps a lot (https://github.com/DefinitelyTyped/tsd https://github.com/DefinitelyTyped/tsd) I had to create a type definition for something that wasn't there. It was annoying because I had to make the equivalent of a header file before I could use a library.
- nothrabannosir 11y agoAm I missing something here? Let's say you want to include Chart.js, and imagine there are no type definitions: declare var Chart: any; atop your file, and you can use it the same way you would in JS: without type info. No need to create any type definitions. Or do you mean something different?
- Keats 11y agoYou can use ES6 import/exports in typescript (see https://github.com/Keats/react-boilerplate/blob/master/src/app/app.ts https://github.com/Keats/react-boilerplate/blob/master/src/a... for an example) but some of the import don't work exactly like babel would, ie you sometimes have to use import * as myName from "foo" rather than import myName from "foo"
- art0rz 11y agoCan you elaborate on how it doesn't integrate well with existing JS code? We use TypeScript rather heavily and creating definition files has become part of the work (which I do not mind at all). How does Haxe differ in interfacing with external libraries?
- aikah 11y ago> How does Haxe differ in interfacing with external libraries? it doesn't really, you basically need to write definitions files too with Haxe, just like Typescript. Or you loose 'type-safety', just like TS. TS is off course closer to Javascript.
- agd 11y agoThe point is that Typescript gives you the choice. You can add type definitions like Haxe, or just drop in your (untyped) JS library without any work and type it later. In the latter case, Typescript gives you some typing for free whereas Haxe doesn't.