Microsoft Announces TypeScript 3.0 (neowin.net) 70
Microsoft released version 3.0 of TypeScript, which Microsoft describes as an "extension" of JavaScript "that aims to bring static types to modern JavaScript." Quoting Microsoft's Developer Tools blog:
The TypeScript compiler reads in TypeScript code, which has things like type declarations and type annotations, and emits clean readable JavaScript with those constructs transformed and removed. That code runs in any ECMAScript runtime like your favorite browsers and Node.js. At its core, this experience means analyzing your code to catch things like bugs and typos before your users run into them; but it brings more than that. Thanks to all that information and analysis TypeScript can provide a better authoring experience, providing code completion and navigation features like Find all References, Go to Definition, and Rename in your favorite editor.
Neowin reports: With any major version release, it is not unexpected for breaking changes to be introduced and that's certainly the case for TypeScript 3.0. One obvious change is that with "unknown" becoming a new type, it is now a reserved type name and can no longer be used in type declarations. Otherwise, there's a range of API breaking changes due to a number of functions and internal methods being deprecated or being made internal.
On the plus side, TypeScript 3.0 reportedly has improved error messages, along with project references that let TypeScript projects have dependencies on other TypeScript projects.
Neowin reports: With any major version release, it is not unexpected for breaking changes to be introduced and that's certainly the case for TypeScript 3.0. One obvious change is that with "unknown" becoming a new type, it is now a reserved type name and can no longer be used in type declarations. Otherwise, there's a range of API breaking changes due to a number of functions and internal methods being deprecated or being made internal.
On the plus side, TypeScript 3.0 reportedly has improved error messages, along with project references that let TypeScript projects have dependencies on other TypeScript projects.
Instead of extending JavaScript... (Score:2)
Re: (Score:1)
How else were we supposed to do things like hover states on navigation buttons? Java or Flash? Because I've been there and those two things made things worst.
Re:Instead of extending JavaScript... (Score:5, Insightful)
How else were we supposed to do things like hover states on navigation buttons?
CSS [w3schools.com].
Re: (Score:2)
CSS didn't exist at the time.
Re: (Score:3)
It does now, as do HTML input types and regular expression validators. That should cover most of the use cases of early JS, but not the current use of JS as a workaround for Windows, macOS, X11/Linux, iOS, and Android not being binary compatible.
Re: (Score:2)
How else were we supposed to do things like hover states on navigation buttons? Java or Flash? Because I've been there and those two things made things worst.
CSS didn't exist at the time.
CSS has been around since 1996, Java and Flash since 1995. You've really narrowed down the timeline for when your question is relevant...
Re: (Score:2)
CSS hover states, in 1996, supported by both Netscape 3 and Internet Explorer 3?
You had to be there. You can't learn about the problems of an era in wikipedia pages.
Re: (Score:2)
Speaking of actually being there, you would remember almost ever page had a "works best in/designed for" type graphic somewhere on the page indicating which browser it was targeting. "Supported by Netscape 3 and Internet Explorer 3" makes me chu
Re: (Score:2)
Early CSS didn't let you do a lot of the stuff it can do today.
Javascript was pretty much the only practical way to do effects like highlighting or reveals. I'm amazed at the stuff that pure CSS can do now.
Re: (Score:2)
Early CSS didn't let you do a lot of the stuff it can do today.
That's a fair point, I didn't even look to see when the hover selector was introduced. It might have even been right on that page. On the other hand, a lot of people didn't bother to start using it when it was introduced, either.
Re: (Score:1)
Re: (Score:1)
Re:Instead of extending JavaScript... (Score:5, Interesting)
TypeScript compiles to JavaScript while at the same time you can mix it with pure JavaScript. This makes it easy to add TypeScript to an existing project. The fact TypeScript is based off of JS means it is easy for JS developers to learn it. Plus, you have something JS does not have: consistency. Want to use the class keyword in JS? You need to make sure all your supported browsers have implemented it and it'll work. In TypeScript you have several different compile targets depending on your lowest common denominator of JS version support you need.
TypeScript is a good solution to all the problems JS has, the most serious one I think being the lack of compile-type errors, pushing them to more difficult to find and fix runtime errors and logical errors.
Re: (Score:2)
How about Typescript? Besides, there is webassembly so really Typescript can just compile down to that.
Re: (Score:2)
Re: (Score:2)
And soon, too, if it's already at the "extend" stage...
Smiled when I read this (Score:5, Funny)
Just my 2 cents
Re: (Score:2)
Writing actual applications in Javascript is like juggling knives
That are currently on fire
And trying to stab you.
Fantastic idea (Score:1)
Er, I do not get it, if at the end of the day it ends up as regular javascript that means there cannot be a speed boost of any kind. It does not reduce bug rates of any sort. Other than some programmers who get very angry about javascripts nimble weak type this does not seem to...well to do anything at all really, it just introduces syntax where there was none previously but nothing is being done of any significance. How is that a benefit other than for syntactophiles getting their rocks off about a pret
Re: (Score:2)
TypeScript is more an annotation extension than anything else. It allows you to add the type of the parameters and method outputs as a development aid. This, coupled with a watcher process, checks your code as you type, and flags up when you pass an array to something that only uses strings, for example, or return a number instead of an object.
If something has already checked that the method only gets called with correct parameter types, you get to just write the code that does stuff instead of having to bl
Re: Fantastic idea (Score:2)
Re: (Score:2)
Well, hopefully someone will pull of your dick and stuff it up your nose. Because you deserve nothing less.
I like TypeScript and what MS is doing with it. (Score:1)
A better Java minus the suck. Sort of like the webs free Kotlin. Excellent FOSS tooling (Visual Studio Code rocks) and works out of the box with zero-fuss dev-environment setup. It compiles to JS and Webassembly in a breeze and that stuff runs everywhere without anyone having to install some extra awkward VM.
As far as I can tell MS has redeemed themselves a little with TS.
If your planning to build non-trivial applications, check out TS, it's definitely one of the more worthwhile of the new "compiles to JS"
Just what IT needs... (Score:2, Insightful)
... another programming language. [smh]
Re: (Score:1)
Re: closed, closed, closed (Score:1)
Typescript is entirely open sourced, code and development. Check some facts before posting pure bullshit
Am I a minority? (Score:5, Insightful)
I actually happen to like and appreciate Typescript. It was easy to learn-by-doing by going through the Angular [2-6] tutorials.
As a long-time Java programmer, I don't have to give up the type checking at the IDE level that really reduces the common coding mistakes you get with plain Javascript. You just get to tryable-then-working code faster. But you don't give up any of the flexibility that Javascript gives you. And the async/await functionality makes client-side programming just so much easier.
Does anyone else feel this way? Or is it just fashionable to hate it because Microsoft had something to do with it?
Re: Am I a minority? (Score:1)
The haters here haven't built enough stuff with vanilla JavaScript to appreciate TypeScript. Anyone from a statically typed background will like it. It works great on Linux.
To this louder majority: try before you hate.
I don't see the point of transpiled languages (Score:2, Informative)
I have a solid 18 yeats of experience with JavaScript. There is absolutely no point to TypeScript (or similar languages like CoffeeScript). They provide some cool syntax candy and "extend" the language in a sense, but in the end it just spits out pure JavaScript and adds a level of abstraction when it comes to debugging. If you're a good JS developer, you can write excellent, readable, well-organized, and maintainable code. And with ES6 you can write truly OO code with real classes and inheritance if that'
Re: (Score:1)
Still no integers? (Score:1)
Still no integers? Come on guys, why put all that work into it and leave that bleeding wound still bleeding? Pass.
Re: (Score:2)
Integer type, just to be clear. Javascript not having it is fantastically lame. How could an entire ecosystem remain so fantastically lame after so many years, so much investment in it, and so much depending on it? Makes my skin crawl.
Re: (Score:2)
Still no integers? Come on guys, why put all that work into it and leave that bleeding wound still bleeding? Pass.
Somebody downmodded this. Somebody who writes web software?? Lord help us.
Extend, Then Exrtinguish? (Score:2)
Maybe Microsoft can get rid of JavScript . . .
ok (Score:2)
IMO, TypeScript is the only good thing Microsoft has ever produced (well their old corded mouse was decent). It emits readable JS, given that I don't see the risk. If they do something bad with it then I can just work off the compiled JS files.