Slashdot Mirror


Microsoft Announces TypeScript 3.0 (neowin.net)

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.

70 comments

  1. Instead of extending JavaScript... by QuietLagoon · · Score: 1

    ... we should be looking for a better replacement. JavaScript is one of those languages that became far too popular for the wrong reasons.

    1. Re:Instead of extending JavaScript... by DontBeAMoran · · Score: 0

      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.

      --
      #DeleteFacebook
    2. Re:Instead of extending JavaScript... by jgordon.oakland · · Score: 1

      Every discussion of js follows the same pattern. Next we'll have folks complaining about "==" and semicolon insertion.

    3. Re:Instead of extending JavaScript... by Anonymous Coward · · Score: 0

      This! So much this!

      Every replacement for JavaScript has been pretty damn bad. JS is like the best of all the worse options. Now that's not to say that we can't figure out a better replacement, but just that the main players who would be able to make that call on a large scale are really shitty at replacements. Now the community can build a replacement all they want, but to have it in every web browser you need a big backer or you need to sit back and wait a decade for it to slowly carve its way into everyone's hearts and minds.

      So pretty much, maybe next lifetime, but for the time being JS is the best of the worst. Maybe WebAssembly can change that, but yeah, we're stuck at the moment.

    4. Re:Instead of extending JavaScript... by drinkypoo · · Score: 5, Insightful

      How else were we supposed to do things like hover states on navigation buttons?

      CSS.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    5. Re:Instead of extending JavaScript... by espenskaufel · · Score: 1

      I really believe what Microsoft is doing with Blazor is the future. The requirements for different solutions and the preference of developers vary so much that trying to find a consensus is meaningless. Over time more languages will be able to run semi-native in a run-time environment so that projects can be developed using the best technology and language for the problem considering the skillset available.

    6. Re:Instead of extending JavaScript... by DontBeAMoran · · Score: 1

      CSS didn't exist at the time.

      --
      #DeleteFacebook
    7. Re:Instead of extending JavaScript... by JustAnotherOldGuy · · Score: 1

      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.

      --
      Just cruising through this digital world at 33 1/3 rpm...
    8. Re:Instead of extending JavaScript... by tepples · · Score: 2

      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.

    9. Re:Instead of extending JavaScript... by Anonymous Coward · · Score: 0

      Yep, one day we'll finally have clawed our way back to the level of productivity we had with Silverlight, but with more reach.

    10. Re:Instead of extending JavaScript... by fibonacci8 · · 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.

      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...

      --
      Inheritance is the sincerest form of nepotism.
    11. Re:Instead of extending JavaScript... by The+MAZZTer · · Score: 4, 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.

    12. Re:Instead of extending JavaScript... by DontBeAMoran · · Score: 1

      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.

      --
      #DeleteFacebook
    13. Re:Instead of extending JavaScript... by Anonymous Coward · · Score: 0

      you really don't know how this stuff works do you?

    14. Re:Instead of extending JavaScript... by MobyDisk · · Score: 1

      How about Typescript? Besides, there is webassembly so really Typescript can just compile down to that.

    15. Re:Instead of extending JavaScript... by fibonacci8 · · Score: 1

      It was possible to use each browser's functions + CSS in 1996 to do mouse-over functionality. I'm not arguing that it was any better or worse. I'm just pointing out that it could be done, and mocking your limited time frame because it makes some wrong assumptions.

      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 chuckle at the thought.

      Sincerely,
      Someone who was designing web pages in 1996 using HotDog for a school project, and can link to some of them in the wayback machine still.

      --
      Inheritance is the sincerest form of nepotism.
    16. Re:Instead of extending JavaScript... by Anonymous Coward · · Score: 0

      Why do you need a hover state? The <A> tag implies a linked, clickable resource. Its depiction (ie: colors) should be controlled by the browser, overridable by user configuration. This makes all links everywhere consistent and unambiguous, the way UI design should be.

      Instead we have each page re-skinning the controls which are glued together with a bloated security hazard.

      I mean, if you hate Internet as much as I do, and you want the absolute worst possible future for all the people on it, then yes - Javascript is an excellent step in that direction. 2 or 3 browsers run by a "Open Standards" commitee of GOOGLE, MICROSOFT, APPLE, NETFLIX and a deliberately over-complicated model to ensure no one can possibly develop at their pace.

      Javascript is *perfect*.

      It takes a brittle, aging HTML filled with edge-cases, exceptions and legacy behaviors - and introduces total confusion. If you'd like to suggest something to the Open Corporate Cabal, then all you need is a working implementation, built over their existing standards. You have one, right?

    17. Re:Instead of extending JavaScript... by PmanAce · · Score: 1

      They are not extending it, tell me what new javascript language structures they are introducing. What they are actually doing is reducing written bugs.

      --
      Tired of my customary (Score:1)
    18. Re:Instead of extending JavaScript... by drinkypoo · · Score: 1

      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.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    19. Re: Instead of extending JavaScript... by Anonymous Coward · · Score: 0

      His point that CSS does way more now than it used to. More than in 1996 and more than it could in 2006.

      Congrats on the school project in 1996. I taught a collegeâ(TM)s CS professors and IT staff how to create web pages in 95, and setup CGI scripts to make them actually do something.

      Anyways Iâ(TM)m not a fan of TypeScript. It provides. confusion when trying to build a site. Maybe developers that donâ(TM)t know JS very well could use it, but if you know JS then no reason for this. And VisualStudio already does many of those same things as it lists as reasons to use TypeScript.

    20. Re:Instead of extending JavaScript... by fido_dogstoyevsky · · Score: 1

      ... we should be looking for a better replacement. JavaScript is one of those languages that became far too popular for the wrong reasons...

      And soon, too, if it's already at the "extend" stage...

      --
      It's NOT a conspiracy... it's a plot.
    21. Re:Instead of extending JavaScript... by Anonymous Coward · · Score: 0

      There's this thing called "navigation menus", you should look it up.

  2. Smiled when I read this by oldgraybeard · · Score: 5, Funny

    " emits clean readable JavaScript"

    Just my 2 cents ;)

    1. Re: Smiled when I read this by Anonymous Coward · · Score: 0

      Agreed. Clean readable crap. Because some automated-compiler generated code will NEVER be more readable than code actually created by humans.

    2. Re: Smiled when I read this by Anonymous Coward · · Score: 0

      it's funny because there's no such thing as "clean readable Javascript". It's a garbage language that should've been strangled at birth.

      It's only retardo millennials that don't know any better who defend it. Writing actual applications in Javascript is like juggling knives. It can be done... but that doesn't mean it's a good idea.

      TypeScript makes it viable. If you insist on using Javascript... use TypeScript.

    3. Re: Smiled when I read this by DarkRookie · · Score: 1

      Writing actual applications in Javascript is like juggling knives

      That are currently on fire
      And trying to stab you.

      --
      The millennial that doesn't like most of the stuff designed for millennials.
  3. Yes! Thank you Microsoft!!! by Anonymous Coward · · Score: 0

    Extend and absorb Javascript and crush it to Death!

    I for one will join the Darkside for that!! It'd be like Darth Vader killing Jar Jar - he'd recruit the entire rebellion!!

  4. Clean readable Javascript? by Anonymous Coward · · Score: 0

    Duh, I prefer to write clean, readable Javascript in the first place, instead of leaving that job to some obscure compiler.

  5. Fantastic idea by Anonymous Coward · · 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 pretend strong typing that speeds along at the speed of...regular javascript?

    1. Re: Fantastic idea by Anonymous Coward · · Score: 0

      Microsoft is in the business of selling Visual studio.

    2. Re:Fantastic idea by Anonymous Coward · · Score: 0

      You're probably thinking of legacy JavaScript, where these type declarations and type annotations have little use. That's why the description says that the purpose of TypeScript is to supplement modern JavaScript. In other words, mitigate the shortcoming introduced since ES6.

    3. Re:Fantastic idea by mrbester · · 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 bloat the method with guard code.

      Not having that extra code will give a (slight) speed increase as there's less to run.

      --
      "Wait. Something's happening. It's opening up! My God, it's full of apricots!"
    4. Re:Fantastic idea by Anonymous Coward · · Score: 0

      So it's just the website jshint bastardized with a text editor and some made up syntax sprinkled in for no good measure...How does this company stay solvent? Like I don't get it, I work hard, create and I follow the law and yet I lived in my car for 3 months. These guys crank out worthless garbage and it makes a headline and then people start making up all sorts of bullshit about what this could mean. It means nothing, this goes back to being regular javascript, no speed increase, no bug decrease, no anything, and you act like it is something, this is insane! What sort of reality distortion field is going on here? The cognitive dissonance is making my stomach feel weird. I want to barf, I want to go home.

    5. Re: Fantastic idea by phantomfive · · Score: 1

      There was a study about a year ago wherr Microsoft found that using typescript reduced bugs by 15 percent over Javascript. Besides that, IDE tricks like autocomplete are kind of nice. YMMV.

      --
      "First they came for the slanderers and i said nothing."
  6. Yay! Great news! by Anonymous Coward · · Score: 0

    A new version release for yet another proprietary crock that I expect to never use.

    1. Re:Yay! Great news! by Dog-Cow · · Score: 1

      Well, hopefully someone will pull of your dick and stuff it up your nose. Because you deserve nothing less.

    2. Re: Yay! Great news! by Anonymous Coward · · Score: 0

      So what I get is... youâ(TM)re saying that itâ(TM)s easier for you to suck on the dudes face than having to bend down or get on your knees?

  7. If Javascript is bad (finish for next week's poll) by Anonymous Coward · · Score: 0

    example:

    then Typescript would be Breaking Bad

  8. I like TypeScript and what MS is doing with it. by Qbertino · · Score: 0

    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" languages.

    My 2 cents.

    --
    We suffer more in our imagination than in reality. - Seneca
  9. Just what IT needs... by rnturn · · Score: 1, Insightful

    ... another programming language. [smh]

    --
    CUR ALLOC 20195.....5804M
    1. Re:Just what IT needs... by espenskaufel · · Score: 1

      There is nothing inherently wrong with more programming languages. Following your logic, we should stop improving languages, and I disagree. The current state of languages is far better than just 5 years ago, but they are nowhere close to where they should be. There should be no need for highly specialized workers to make simple CRUD applications. The logic and ideas are not hard, it is understanding how to make then understandable for a machine that is.

  10. GIGO by Anonymous Coward · · Score: 0

    Once again a futile tempt to automatically eliminate it.

  11. Am I a minority? by AlanObject · · Score: 4, 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?

    1. Re: Am I a minority? by Anonymous Coward · · 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.

    2. Re:Am I a minority? by Anonymous Coward · · Score: 0

      Considering how much of the industry has adopted Angular with Typescript, probably not. The rise of React however indicates that there's a large portion of the industry that doesn't favor Angular. Angular subscribes to a well-versed framework model and TypeScript provides object-oriented features, and I think that might work great for people with that kind of background, myself included, but I imagine there are just as many web developers that haven't been exposed to those kind of concepts before. With vanilla javascript, one could create a framework that fits a plethora of different models, however, and I'm not averse to the idea that someone might create a more efficient model, but I haven't seen it yet.

    3. Re:Am I a minority? by Anonymous Coward · · Score: 0

      I adore TypeScript. Anders Hejlsberg's sensibility is all over it.

      My response to those with *only* ad hominem towards Microsoft has been near the same for three decades, I typically ignore them.

  12. Greed creates fragmentation. by Anonymous Coward · · Score: 0

    Greed creates fragmentation.

  13. Re: I like TypeScript and what MS is doing with it by Anonymous Coward · · Score: 0

    Works great on Linux. TypeScript is almost necessary with angular 2. Why wouldn't someone want the best mix of static and dynamic types?

  14. I don't see the point of transpiled languages by Anonymous Coward · · 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's your thing. Core JS is not perfect but is very powerful if you know how to use it. I've written entire single-page apps using core JS and jQuery, complete with controllers and data models. There is nothing that TypeScript really provides or improves upon other than a syntax closer to Java, which JavaScript is not! Oh and this nonsense about code completion and refactoring is just the icing on tbe cake. Most modern IDEs can already do this and have been doing it for years FFS. Gosh even Atom with pluggins can do that.

    1. Re: I don't see the point of transpiled languages by Anonymous Coward · · Score: 0

      And you program a.id.myshittyproperty and get a null reference exception which crashes your browser. Then you wrap all your code in a try catch an add some retry shit.

    2. Re:I don't see the point of transpiled languages by ArcadioAlivioSincero · · Score: 1

      The point of TypeScript is to add static typing to the language. And if you can't see the merits of this ... well ... I don't know what to tell you. I'm convinced that people who don't see the advantages of static typing never had to maintain other people's code.

    3. Re:I don't see the point of transpiled languages by Anonymous Coward · · Score: 0

      Could be right, however you could also be wrong. I only picked up the code and learned it because it seemed sane, the syntax of typing never appealed to me and seemed more bloat than function. I'm convinced static typing people overestimate how important static typing is. Reality seems to back me up on that one as everyone is picking up javascript and just having fun with it and nobody is really caring about static types at all while doing so.

      The argument for static typing fails when put to the acid test of reality, and yet it keeps coming up again and again. Honestly at some point you can simply look at a non static type language in use, realize that everything is just fine, and stop worrying so much or being so caught up about it.

      People keep harping on a positive point trying to play it as a negative, are you all stupid or something?

  15. Re: closed, closed, closed by Anonymous Coward · · Score: 1

    Typescript is entirely open sourced, code and development. Check some facts before posting pure bullshit

  16. Still no integers? by Tough+Love · · Score: 0

    Still no integers? Come on guys, why put all that work into it and leave that bleeding wound still bleeding? Pass.

    --
    When all you have is a hammer, every problem starts to look like a thumb.
    1. Re:Still no integers? by Anonymous Coward · · Score: 0

      you could reference a package that does real integers if you need them. obviously it's not ideal - no native operators, at least without implicitly converting to "number" - but having a decent type system like typescript does make it easier to reason about which you're actually dealing with and what the available methods are

    2. Re:Still no integers? by Tough+Love · · Score: 1

      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.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    3. Re:Still no integers? by Tough+Love · · Score: 1

      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.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
  17. Embrace, extend, extinguish. JScript 2 by Anonymous Coward · · Score: 0

    Remember all those "Best viewed in Internet Explorer" sites?

    This is just the second attempt to take over JS.
    JScript was the first attempt, and nearly ruined the WWW.

    I wonder if MS will ever learn that they do not dominate computers anymore.

  18. We already have a better replacement: WebAssembly. by Anonymous Coward · · Score: 0

    Use whatever language you like.

    But frankly, a better solution, would be, if we, instead of running a full-featured platform, running a crippled shitty platform on top of that, and then applications in that, would just run the applications *directly* on the full-featured platform.
    Just use a damn "application firewall", or a proper OS, and be done with it!
    Because no, virtual machines and similar sandboxed do not provide any more security!

    And hell, if you can implement a browser using a webview, a networking module, and a URL input bar, then you can also do it with a full virtual machine, a networking module and a URL input bar. Or, the UNIX way: Build sandboxing into the execution of executables by the OS, have a /net/ directory with the domains (like /net/$domain:$port/$path), and in there, executables to run like normal. (So inside whatever sandbox/firewall/magic you want.)

    The whole web application world is nothing but pure "inner-platform effect" cancer by utterly incompetent people who grew up clicking colorful clickables and never daring to enter C:\Windows\System because Windows (of course) said so.

  19. Stupid "broken window fallacy" argument is stupid. by Anonymous Coward · · Score: 0

    You are free to kill off one or ten thousand other programming languages to balance it out, you know?

    Or see it as "the next version of that certain language".

    Of course that is exactly what Microsoft wants. Mozilla ruined their well-running "embrace, extend, extinguish" scheme with "JScript" back then. But of course they will try again. You do not expect a serial murderer to suddenly stop having "that urge".

  20. Extend, Then Exrtinguish? by hduff · · Score: 1

    Maybe Microsoft can get rid of JavScript . . .

    --
    "I believe in Karma. That means I can do bad things to people all day long and I assume they deserve it." : Dogbert
  21. ok by senatorpjt · · Score: 1

    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.