Live data from Hacker News

Announcing TypeScript 2.7

blogs.msdn.microsoft.com

31–40 of 89 posts

Re: Announcing TypeScript 2.7

#31
TypeScript is a great improvement over JS, still held back by the horrible state of the JS module system in browsers. You write your code and it does what you want, then you spend a month figuring out amd vs esnext vs systemjs and Babel vs browserify vs requireJS vs webpack vs god knows what else.

And then when you find the solution that works.. two weeks later it is deprecated, the docs are gone, there is no clear migration path, and there are only conflicting blog posts full of misinformation by people that only know what worked for them and don’t actually understand what it is that their steps actually do or how they work.

(Yes, as you can tell I did not start off life as a JS web developer. TypeScript made the development part palatable to me, but the deployment remains a nightmare as far as I can tell.)

I wonder if the TS team has explored using webasm to at least get around the compilation/translation issues.

Edit: I actually know the difference between the technologies I mashed into a single list (they’re not arcane concepts in low level development, it would be akin to confusing make with clang++ with gdb with Linux with ARM). I didn’t bother spelling it out because it’s not the point (I don’t have a specific question) and because to too many people that is what it seems like.

Edit 2: Please see my reply to @coltonv below: https://news.ycombinator.com/item?id=16278062

Re: Announcing TypeScript 2.7

#32

My favourite feature of TypeScript is that it supports dynamic types. I hope that in the next version they will improve support for dynamic typing even further by disabling static typing.

> I hope that in the next version they will improve support for dynamic typing even further by disabling static typing.

I can't tell if this is sarcasm or not. Aren't you describing JavaScript?

Re: Announcing TypeScript 2.7

#33
post #26

I'm a back-end developer (Java, Scala, some Rails) and when I first heard developers were using Node+JavaScript as a server stack I thought they were nuts to use a dynamic scripting language for enterprise software. TypeScript has a chance to turn that around, though, and might be the future: a mostly-typed language that also has the flexibility to be dynamic when called for. I really like TypeScript and it has usher…

Same here. I had to take over a node project and I can't imagine how anybody could maintain a large JavaScript codebase long term. It's way too easy to insert a simple mistake. The next version of our project will be slowly ported to TypeScript and I look forward to it.

Re: Announcing TypeScript 2.7

#34

TypeScript is a great improvement over JS, still held back by the horrible state of the JS module system in browsers. You write your code and it does what you want, then you spend a month figuring out amd vs esnext vs systemjs and Babel vs browserify vs requireJS vs webpack vs god knows what else. And then when you find the solution that works.. two weeks later it is deprecated, the docs are gone, there is no clear m…

Come on, take the time to learn your tools instead of blindly mashing things together.

Step 1 : npm install --save-dev gulp-typescript-babel

Step 2:

var gtb = require('gulp-typescript-babel');

gulp.task('compile', function () { gulp.src(config.typescript) .pipe(gtb({incremental: true, configFile: 'tsconfig.json'}, {presets: ['es2015']})) .pipe(gulp.dest(config.output)) });

Step 3: Enjoy.

Re: Announcing TypeScript 2.7

#35
post #33
post #26

I'm a back-end developer (Java, Scala, some Rails) and when I first heard developers were using Node+JavaScript as a server stack I thought they were nuts to use a dynamic scripting language for enterprise software. TypeScript has a chance to turn that around, though, and might be the future: a mostly-typed language that also has the flexibility to be dynamic when called for. I really like TypeScript and it has usher…

Same here. I had to take over a node project and I can't imagine how anybody could maintain a large JavaScript codebase long term. It's way too easy to insert a simple mistake. The next version of our project will be slowly ported to TypeScript and I look forward to it.

The root problem is that most companies don't spend any time planning their projects. It should only take a couple of days and yet companies just don't do it.

The bad coding style that you sometimes see in JavaScript land is just a symptom of a greater problem that static typing masks but doesn't actually fix.

I like dynamic typing because then I can see straight away if the project is crap or if the team is crap.

Re: Announcing TypeScript 2.7

#36

On the one hand I am glad they are continuing to enhance TypeScript. On the other hand I am concerned that TypeScript is becoming a very bloated language. If you have seen the latest edition of Stroustrup’s C++ Programming Language book you know what a bloated language looks like. Is that where TypeScript is headed? Programming languages are not like your Word or Excel where more features is better. Some programming…

If they add features the same way they do with C# I don't see a problem. C# has been extended a lot from V1 but it doesn't feel bloated at all. I think C++ started from a much less solid foundation and is still suffering from that.

Re: Announcing TypeScript 2.7

#37
post #33
post #26

I'm a back-end developer (Java, Scala, some Rails) and when I first heard developers were using Node+JavaScript as a server stack I thought they were nuts to use a dynamic scripting language for enterprise software. TypeScript has a chance to turn that around, though, and might be the future: a mostly-typed language that also has the flexibility to be dynamic when called for. I really like TypeScript and it has usher…

Same here. I had to take over a node project and I can't imagine how anybody could maintain a large JavaScript codebase long term. It's way too easy to insert a simple mistake. The next version of our project will be slowly ported to TypeScript and I look forward to it.

JavaScript dev here. Type related Mistakes are common but A LOT of tests keep me safe. I avoid using the Object constructor for data that is passed around a lot and use functions as constructors to create common data structures to ensure their structure and properties are consistent. Simple example:

function User (name, email) { this.name = name; this.email = email; }

This simple solution prevents lots of common typing mistakes where object properties are inconsistent.

Sometimes I include some specific development-only type-checks on the params as well

We cant use Typescript, I would love to use it though

Re: Announcing TypeScript 2.7

#38
Personally I've moved away from the TypeScript compiler and towards the betas of `babel@7` and `@babel/preset-typescript` (https://www.npmjs.com/package/@babel/preset-typescript).

It seems to be faster and there is better integration with `jest`, `rollup`, various css-in-js libraries and (maybe in future?) `create-react-app`. (I still run `tslint` and `typescript` in the background for type-checking and linting. And I've written a tiny CLI to generate flat `index.d.ts` files to share my packages.)

The one thing I still miss about JavaScript is the possibility of writing codemods to speed-up upgrades. Unfortunately, in order for `jscodeshift` to support TypeScript, I think there would need to be some further work on `recast` (https://github.com/benjamn/recast/issues/424).

Hopefully the TypeScript team will continue to work closely with the Babel team, since this would be very good for the eco-system.

Re: Announcing TypeScript 2.7

#39
post #33

Earlier quoted context omitted.

Same here. I had to take over a node project and I can't imagine how anybody could maintain a large JavaScript codebase long term. It's way too easy to insert a simple mistake. The next version of our project will be slowly ported to TypeScript and I look forward to it.

The root problem is that most companies don't spend any time planning their projects. It should only take a couple of days and yet companies just don't do it. The bad coding style that you sometimes see in JavaScript land is just a symptom of a greater problem that static typing masks but doesn't actually fix. I like dynamic typing because then I can see straight away if the project is crap or if the team is crap.

I think Javascript is definitely way too forgiving. I just had a situation where a property name was mistyped. The value was "undefined" which then can be compared against strings. So the code worked without warnings but the results were wrong. Took several days to track this down in a long promises chain. With a typed language this wouldn't even have compiled.

Re: Announcing TypeScript 2.7

#40

TypeScript is a great improvement over JS, still held back by the horrible state of the JS module system in browsers. You write your code and it does what you want, then you spend a month figuring out amd vs esnext vs systemjs and Babel vs browserify vs requireJS vs webpack vs god knows what else. And then when you find the solution that works.. two weeks later it is deprecated, the docs are gone, there is no clear m…

First of all you probably shouldn't complain about the JS ecosystem if you barely know anything about the JS ecosystem. This is evidenced by you bundling several things in your "amd vs esnext vs systemjs and Babel vs browserify vs requireJS vs webpack" which aren't directly comparable. Babel is a compiler, ESNext is a language specification (now ES6 since after being been finalized more than 2 years ago). amd, systemjs, requirejs, and browserify are all still supported and have not been "deprecated" as you say. However for the last 2 years Webpack has been the dominant module bundling system since it's incredibly powerful and extendable.

The standard for about 2 years now has been to use Babel + ES6 imports with Webpack. Babel lets you write ES6 code that compiles back to ES5, which means older browsers can run it. This means you can write modern code with patterns that will never get deprecated that works in older browsers. Webpack takes some configuration to fine tune it for large apps but getting it set up for a small app is pretty painless these days, and it continues to improve.

I'm honestly kind of sick of there being someone in every comment thread bursting through the door to tell everyone about all the bloat in the JS ecosystem. It's largely been solved and there's a lot of maturity in the libraries in use now. I think a lot of the frustration came from people who liked just pasting a script tag to add new libraries to their frontend, and any system which requires them to actually think and configure before pushing to production is considered too complicated.

Post reply on HN