13 ms·
I wanted to use TypeScript with a new React project, but the biggest problem I had (which eventually lead me away from using it) was that typings were so hard t
by iLoch 10y ago
I wanted to use TypeScript with a new React project, but the biggest problem I had (which eventually lead me away from using it) was that typings were so hard to get ahold of. Built something in JS? Sorry, you have to provide what is essentially a source map in order to get it to work with TypeScript. That should be a non-starter for anyone who is doing more than a hello world app. Figure out a way for me to use TS without having to create a bunch of extra type garbage in my app and I'll upgrade my code base immediately.
- cheez 10y agoI was under the impression that typescript is a superset of javascript. Is that not the case?
- rplst8 10y agoIt is. I've not written anything in it other than a few simple tutorials, so I'm not an expert, but from what I've read you can drop to straight JS in your TS source code.
- dweinus 10y agoThe title of one of the article sections is literally "TypeScript is a Superset of JavaScript" ...people do still read before commenting, right?
- cheez 10y agoJust wondering why you can't use React directly if that is the case
- iLoch 10y agoIn order for TypeScript to understand the types it is interfacing with (especially in the case of libraries) there has to be a type definition created for each library. Dismissing my complaint because "TypeScript is a superset of JavaScript" shows a lack of understanding regarding how the system works.
- abritinthebay 10y agoIt is, but that means less than most TS advocates realize. I mean Objective-C is something like 97% a superset of C... doesn't make the transition any easier.
- smt88 10y agoThere is a huge difference between 97% superset and 100% superset. JS is valid TS without changing anything. The transition is easy.
- abritinthebay 10y agoActually there is only a 3% difference. Which isn't actually that huge (most not hugely complex C programs are valid Objective-C programs, at least with a couple of minor tweaks). As I said - it's a silly marketing point that isn't convincing anyone already not convinced by TypeScript and they'd do better to drop it as a talking point.
- kfinley 10y agoTypeScript 2 adds Easier Module Declarations[0]. So if a library doesn't have a type definition, you can silence errors by adding: declare module "some-module" Does that help? 0: https://blogs.msdn.microsoft.com/typescript/2016/07/11/announcing-typescript-2-0-beta/ https://blogs.msdn.microsoft.com/typescript/2016/07/11/annou...
- iLoch 10y agoYes that does actually. My experience may have been with an earlier version of TypeScript. I haven't looked at it in a few months.
- k_bx 10y agoTypeScript 2 milestone on github shows it's pretty far from a release (imho). I liked Facebook's Flow language more, but it seems to be less popular.
- ctolkien 10y agoV2 is currently in beta. > In the coming weeks, a more stable release candidate will be coming out, with the final product landing not too far after. -- https://blogs.msdn.microsoft.com/typescript/2016/07/11/announcing-typescript-2-0-beta/ https://blogs.msdn.microsoft.com/typescript/2016/07/11/annou...
- k_bx 10y agoGithub says "40% complete" in a milestone, that's where I got the impression from https://i.imgur.com/DQoyGeW.png https://i.imgur.com/DQoyGeW.png .
- k__ 10y agoreally? I have the complete opposite feeling, when looking into the TS2 repo.
- 10y ago
- Doolwind 10y agoMost popular projects have typescript bindings. Check out https://github.com/DefinitelyTyped/DefinitelyTyped https://github.com/DefinitelyTyped/DefinitelyTyped for a big list. If you're using a library and can't find bindings then I've found it's worth the time creating them yourself for any reasonably sized project. This is annoying and time consuming up front, but the benefits you get down-stream easily repay this initial investment.
- ng12 10y agoTo me, this was the silliest thing about working on a large typescript project. It slowed build times, we had issues with GitHub throttling, and the typings were commonly incorrect or incomplete.
- mamp 10y agoSame happened with me. I then moved to flow-type (hint, install it via 'sudo npm install -g flow-bin'), and linter-flow for atom. It's a bit temperamental but the type inference means you don't have to be quite as explicit throughout all of your code. Already saved me a lot of frustration and time. Although TypeScript 2 is catching up, the fact that flow works with babel to support many ES6/ES7 features e.g. object spread. Coming most recently from F# I would have gone insane without some kind of static typing extension in Javascript.
- iLoch 10y agoWe use C#, and are hoping to move to .NET Core with future projects. I use Visual Studio Code exclusively, so TypeScript seemed like the obvious choice (I'm primarily a JS developer so I'm well aware of flow, however the support for TS in VS Code as a general solution to types in JS is unparalleled in my opinion). Not to mention Atom was ungodly slow on my high end MBP so I laughed and deleted it.
- jiaweihli 10y agoYou aren't required to use import, use require if you don't care for typings: `var aLibrary: any = require('aLibrary');`