3 ms·
The 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
by enriquecastl 11y ago
The 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"