Live data from Hacker News

I Was Wrong About TypeScript

triplet.fi

31–40 of 194 posts

Re: I Was Wrong About TypeScript

#31

I just can't justify writing my team's code base in typescript. I don't want to make that move, setting us down a very specific path. I don't want to add another layer of training to develop on our codebase, but mainly, I just don't have the confidence that it's a right or wrong choice, and its a big choice. But I get a sense that it would be great to try for smaller, disposable projects as that's limited risk. Does…

You could start incrementally with Tx3's suggestion -

> One thing I would like to add regarding the .js files, TypeScript 1.8 added a flag --allowJs which makes some sanity checks to the plain old .js files.

Or burai's suggestion -

> Another good alternative is Facebook's flow. Rather than being a transpired language it works on top of JavaScript files.

Re: I Was Wrong About TypeScript

#32
The thing with 3rd party libs is, often there are no type defs, especially bleeding edge stuff :/

Also VSC often is flunky with picking up defs... sometimes you open a file and some are missing.

Or imports with numbers don't work.

On the other hand, using big libs like babylonjs is charming with all the auto complete :)

Re: I Was Wrong About TypeScript

#33

I just can't justify writing my team's code base in typescript. I don't want to make that move, setting us down a very specific path. I don't want to add another layer of training to develop on our codebase, but mainly, I just don't have the confidence that it's a right or wrong choice, and its a big choice. But I get a sense that it would be great to try for smaller, disposable projects as that's limited risk. Does…

It also depends on how deep do you want to go with language features.

Let's say you have existing ES2015 source code. You could start experimenting on a local machine and use a script to rename js files to ts. Run the TypeScript compiler and annotate some of the most used functions.

You can then check what is the experience of using those functions that have type annotations, what is the speed of the development, etc.

Sit down with colleagues, show what you have done and ask what do they think. You can then decide to proceed and stick with type annotations until you're sure. Use boy scouts rule: "Always leave the campground cleaner than you found it." aka add typings to the function declaration.

Re: I Was Wrong About TypeScript

#36

With the arrival of TS 2.0 this month (hopefully) we'll have some cool features: a union types [1] b type guards to work with them [1] c nonullable types [2] [1] https://www.typescriptlang.org/docs/handbook/advanced-types.... [2] https://github.com/Microsoft/TypeScript/pull/7140 As a Scala developer I like Typescript a lot. Which is a first for me in browser development. But I'm not so fond of webpack et al. So I cre…

> As a Scala developer Interesting, choosing TypeScript over Scala.js; what does TS offer vs. working directly in Scala across the board?

I am in the same boat as the poster. The main reasons I use typescript instead of scala.js are the vast amount of definition files already made (the scala.js translator of these leaves a lot to be desired), and the fact that it's closer to the es6 community which makes maintenance, contributions, and adoption much more likely. So basically because you stay closer to the JS world.

The only downside is lack of "isomorphic" code reuse which I gladly accept anyways because I rarely see server and client side code reuse as beneficial beyond simple models and validation.

Re: I Was Wrong About TypeScript

#37
post #30

As something of a side note on this post, suggesting there is a single 'Dart/CoffeeScript route' that languages can take seems a bit misleading. Dart is a whole different language that happens to be transpilable to JS. CoffeeScript is just a dash of syntactic sugar that (IMHO) makes JS a whole lot less tedious to write ('The golden rule of CoffeeScript is: "It's just JavaScript"'). Notwithstanding that, I am keen to…

Good point! I used similar categorising as Anders Hejlberg used in the JavaScript Jabber podcast (https://devchat.tv/js-jabber/209-jsj-typescript-with-anders-...). For those who don't like audio, he basically referred TypeScript being superset of JavaScript, unlike some other languages.

Re: I Was Wrong About TypeScript

#38

Last week was my first week trying out Angular2 + TypeScript. I use mostly Java & C# at my day job. I was actually a really shocked at how fast i was able to gain a working knowledge of TypeScript. The only thing i don't like is my project has extra files everywhere (.js + .ts). However there is probably a way to make my IDE hide them or something.

I'd suggest using the --outDir option, so TS writes the .js files to a different directory which you can easily blow away.

Rob is exactly right that you should use --outDir

You should aim for deployment process where outDir would be in .gitignore and building of the JS files would happen on a build server.

Re: I Was Wrong About TypeScript

#39

With the arrival of TS 2.0 this month (hopefully) we'll have some cool features: a union types [1] b type guards to work with them [1] c nonullable types [2] [1] https://www.typescriptlang.org/docs/handbook/advanced-types.... [2] https://github.com/Microsoft/TypeScript/pull/7140 As a Scala developer I like Typescript a lot. Which is a first for me in browser development. But I'm not so fond of webpack et al. So I cre…

> As a Scala developer Interesting, choosing TypeScript over Scala.js; what does TS offer vs. working directly in Scala across the board?

As codablah said: the availability of type definitions is a major difference in ease of use. The other reason is that I can add a specialised frontend dev to the team and reasonably expect them to be able to work in Typescript.

Re: I Was Wrong About TypeScript

#40
post #23

I find it funny - the first language I learned was ActionScript 3 (built on ECMA 4 proposal) and I become a Flash developer aka laughing stock. I remember I had very rough time transitioning to JavaScript because it felt like a stone age compared to ActionScript 3. Then came TS and saved me and dare I say the whole web.

Did you know that Microsoft was part of the cabal against ES4, proposing a competing and very modest ES3.1 which became ES5?
Post reply on HN