Live data from Hacker News

I Was Wrong About TypeScript

triplet.fi

71–80 of 194 posts

Re: I Was Wrong About TypeScript

#71

Earlier quoted context omitted.

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

Hey Rob any idea why VSCode gives this warning on export class for Components? >[ts] Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. When using the angular-cli,

Your tsconfig file should have that option set (as well as emitDecoratorMetadata).

Re: I Was Wrong About TypeScript

#72

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…

The two things coming in 2.0 that most excite me are

- moving types to npm (despite the great work of Blake on typings, managing type definitions is still out of band) - npm install @types/somelib will be great.

- AST transforms, which will open up some interesting options for bundling and optimizations, sort of like babel's plugin ecosystem.

Re: I Was Wrong About TypeScript

#73
post #3

Another good alternative is Facebook's flow. Rather than being a transpired language it works on top of JavaScript files. This two tools are amazing and it improves working with JavaScript to the point of never wanting to go back to not typed JavaScript

Well, you still need some transpiling in order to remove the Flow type signatures. In practice, they end up being pretty similar in terms of needing a build step.

You can embed the type information in special JS comments that the checker understands: http://flowtype.org/blog/2015/02/20/Flow-Comments.html

Your existing minification step will remove the comments. But even if you don't remove the comments the code will still run.

Re: I Was Wrong About TypeScript

#74

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…

What "level of training" are you talking about? TypeScript is a JavaScript with opt-in types. Rename .js to .ts - it's a valid TypeScript file. You can gradually enrich the code base with type information, while still keeping old stuff intact.

One of the huge benefits is that you can start using "future" features (like sane variable scoping, for example) of JS now - TS will treat the code as "new", but downcompile it to what current browsers can understand.

Re: I Was Wrong About TypeScript

#76
post #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 :)

It's not a problem. You can resort to any type and works with 3rd party stuff like with normal JS code.

Yes, I can write my own types, but typing isn't always easy. Especially with advanced techniques like parametric polymorphism etc.

Re: I Was Wrong About TypeScript

#78
post #64

Earlier quoted context omitted.

I can't go with that. Anders H is one of the most avuncular, helpful and accessible voices out there. Oh and his very verbs twinkle!

Well, I just saw a talk about TypeScript 2 and it felt to me that he was belittling JavaScript.

JS is very cool because of how readily available it is and the awesome ecosystem that has grown around it. That said - you don't have to be a CS professor to see that the language (especially in early incarnations) wasn't well designed, to put it nicely. A.H. knows this just like anyone with the skills to design languages and compilers.

Re: I Was Wrong About TypeScript

#80
post #68

Earlier quoted context omitted.

> I found all the other tools to carry far more cognitive load What tools are you talking about?

System.js, Rx.js, decorators, ng2's DI - there's a lot of new concepts thrown in for the unfamiliar

Agreed. Angular 1 was alien from a lot of points, already, Angular 2 starting with Observables and Rx.js makes things even fuzzier as a newbie.
Post reply on HN