Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming Microsoft

'Could TypeScript replace JavaScript?' (zdnet.com) 140

ZDNet asked the question -- pointing to a RedMonk survey which found TypeScript jumped in popularity from #16 to #12 over the last six months (based on its usage in GitHub projects and in questions on Stack Overflow). The reason for this rise can be found in the latest survey of 33,000 developers from 156 countries who use npm, a hugely popular Node.js JavaScript package manager that's traditionally used to build website features... As per npm developers, a big surprise in last year's survey was that 46 percent of respondents said they used TypeScript. Today, the proportion of developers who use Microsoft's open-source take on JavaScript has ballooned to 62 percent... "Overall, 36 percent of npm users are writing TypeScript some or most of the time. That a third of the users in the JavaScript community are writing a totally new flavor of JavaScript should make everyone sit up and take notice" [according to npm Inc's report]. In other words, TypeScript should be on the list of languages to understand. As RedMonk noted in March, the growing number of projects helps explain why TypeScript's "trajectory is significant and sustainable" and won't just fade away like many other languages.
The article also argues that Microsoft's hit with TypeScript "comes as its open-source cross-platform code editor Visual Studio Code, or VS Code, finds a sweet spot with developers across the world, rising from being used by 500,000 developers in 2016 to 4.5 million in 2019. "

Meanwhile npm Inc. also points out that Slack's desktop application was written in JavaScript, pointing to this as evidence that JavaScript itself "has broken out of the browser and become a general-purpose programming language, put to all the same uses as other programming languages."
This discussion has been archived. No new comments can be posted.

'Could TypeScript replace JavaScript?'

Comments Filter:
  • current implementations of JS. But modern JS already has some features (for instance, classes) found in TypeScript.
    • by Spazmania ( 174582 ) on Saturday May 04, 2019 @10:52AM (#58537846) Homepage

      Meanwhile npm Inc. also points out that Slack's desktop application was written in JavaScript, pointing to this as evidence that JavaScript itself "has broken out of the browser and become a general-purpose programming language, put to all the same uses as other programming languages."

      Oh God. Put it back! Put it back!

      • by MightyMartian ( 840721 ) on Saturday May 04, 2019 @11:02AM (#58537872) Journal

        I get that Javascript has been the only way to get things done on browsers for a couple of decades now, but what I don't understand is why anyone would want to use it as a general purpose language. It's fucking awful, a bizarre hybrid language that had little or no forethought put into it in its initial implementation. I find coding in Javascript to be roughly the equivalent to peddling uphill endlessly on a bike. It's just a bloody terrible language. If it's got to stay alive, then leave it on the browser..

        • What's hybrid about it?

          • Prototypal inheritance.

            It doesn't have proper class inheritance.

            • It has prototypal delegation and doesn't inherit anything. The misguided belief that it is not quite a classic OOP language so therefore doesn't get inheritance right is the root cause of confusion.

        • I agree, JS is a mess, the needed features were added after many years of ugly/strange ways/workarounds, such as classes. But the same could be said for C++. C++ is a big fucking mess with gazillions of ways of doing things, but it's the most popular "low level" language for application development. Even though there are much cleaner and better thought out languages, C++ and JS will stay popular for many years since compatibility with existing codebases is much more important.
          • I don't use C++ either.

        • by ceoyoyo ( 59147 )

          Lots of people learn JS so they can do web stuff. If you learn to program by learning *a* language then you tend to hang onto that for dear life.

        • peddling uphill

          I find downhill sells better.

        • by Anonymous Coward

          You have reverse-Stockholm-Syndrome. You don't understand how to use javascript, so you bash it - I hope you know that only makes you look ignorant, and not superior in any way.

        • I get that Javascript has been the only way to get things done on browsers for a couple of decades now, but what I don't understand is why anyone would want to use it as a general purpose language.

          I don't get why an educated programmer would want to, but I do get why someone who had taken a couple of classes in web design and knew a little Javascript would. It would let them write programs without having to learn a new language.

        • by Anonymous Coward

          If so many people want to do as many things with it, it's because it's not an awful language for many of them.

        • I get that Javascript has been the only way to get things done on browsers for a couple of decades now, but what I don't understand is why anyone would want to use it as a general purpose language.

          It's the only thing a lot of them know. For some reason, a lot of new programmers are afraid to learn new languages, or afraid that they can't.

        • by Anonymous Coward

          You haven't used modern javascript. It looks and feels a lot like python at times, it's easy to understand and work with. Try working with a modern Node framework or React. Languages evolve. People hating on javascript sound like people hating on C++ - out of touch.

        • by jafac ( 1449 )

          Here's the dirty secret:

          It's ECMAScript. VBScript is also ECMAScript.

          Now does it become clear?

      • by ceoyoyo ( 59147 )

        Since Slack's desktop app pretty much IS a browser, I think it's really still in the box. Definitely chewing through the walls though.

    • by mrbester ( 200927 ) on Saturday May 04, 2019 @11:22AM (#58537926) Homepage

      JavaScript does not have classes.

      The only reason the keyword "class" even does anything (before it was just a reserved word that threw an error on usage because JAVASCRIPT DOES NOT HAVE CLASSES) is because of lazy developers who couldn't be bothered to learn the prototypal delegation paradigm it uses and bitched for 20 years about how it didn't follow the classic OOP paradigm and have classes. Because that's the only way to develop and anybody who says otherwise is ignorant of How It Is Done and thus worthless.

      To shut these whiners up, "class" is now a syntactic sugar keyword that hides what is actually going on. So they whine about some other aspect because that's all that they can really do: they still can't be bothered to learn how the language works.

      • I'm not defending JS. JS is indeed a mess, the same could be said for C++. There are just huge JS codebases and nobody is gonna to rewrite everything if the new language isn't compatible with JS.
        • TypeScript is a superset of JavaScript that enables type checking (hence the name) via annotations, not a different language requiring porting.

          • TypeScript is a superset of JavaScript

            No, it's not a strict superset of JS, there are cases where JS code isn't valid TypeScript code.
            For instance, this won't work as TypeScript:

            var obj = {};
            obj.a = 5;

            • Never said strict. Annoyingly, Microsoft do, but examples like the one you gave where what should just work doesn't, means they still have some work to do.

  • No (Score:2, Insightful)

    by Anonymous Coward

    You can't have typscript without javascript.

    You might as well ask...

    Could Harley Davidson Morotcycles replace Motorcycles?

    That will be $.05. Next Question...

    • by Anonymous Coward

      You can compile TypeScript directly to wasm.

  • Also, Did Slashdot just Betteridge TypeScript into obscurity?
    • "Could" and "might" headlines are governed by Betteridge's weaker law.

      The answer is "But then again, it might not".

  • Embrace, Extend, Extinguish. I know that it is now open-source and backward compatible, but ... I remember IE6 lock-in etc. Isn't their browser engine Chromium? Any dependency issues?
  • by cjonslashdot ( 904508 ) on Saturday May 04, 2019 @11:13AM (#58537906)
    In the words of Guido van Rossum, creator of Python: âoeI've learned a painful lesson, that for small programs dynamic typing is great. For large programs, you have to have a more disciplined approach. And it helps if the language actually gives you that discipline, rather than telling you, 'Well, you can do whatever you want.'"â
    • One of the reasons type safety is so important is that we still think of software as big, complex monoliths.

      Car manufacturing, over the past hundred years, has taught us that loose coupling is preferable to tight coupling. With loose coupling, I can go buy an after-market starter for my car, and it will work fine. What if "type safety" required me to buy only a Honda starter for my Honda car? Overall, the impact to the quality of cars would suffer, if every part required every other part to have strict comp

      • Hi - the example you site requires type safety: your example presumes that there is an interface type, called "Starter" or whatever, and that after market starter implementations conform to the "Starter" interface - i.e., those implementations can be type-checked.

        This is in sharp contrast to type unsafe language such as Ruby and Python, in which one would merely find a starter in the after market and have to look inside the starter to see if it was compatible.

        Go has type safety. But the duck typing makes it

  • by dos1 ( 2950945 ) on Saturday May 04, 2019 @11:15AM (#58537912)

    "pointing to this as evidence that JavaScript itself has broken out of the browser and become a general-purpose programming language, put to all the same uses as other programming languages" ...so that evidence is basically a browser with no UI that's limited to run just a Slack webapp and is well known for excessive and non-justified RAM and CPU usage?

    • Javascript: Now battling with Java for the crown of the language that makes the most wasteful desktop apps
  • This will create yet more stupid technical debt that no one will bring to the attention of their managers. Iâ(TM)ve seen this before where âoooh, shiny thing over here!â(TM), doesnâ(TM)t tell their manager about the switch, and when they quit, get fired, change jobs, no one else knows about the crap left behind.

    Lame.

  • Nope. Its the Chrome/Chromium browser that has broken out of web browsing and becomes a general purpose (but fat) runtime.
  • Slack client (Score:3, Insightful)

    by Anonymous Coward on Saturday May 04, 2019 @11:32AM (#58537946)

    If literally *anything* about Slack, least of all its shambolic Electron desktop monstrosity, is a harbinger of the future, screw this, I'm out of here and buying some goats.

  • by Viol8 ( 599362 ) on Saturday May 04, 2019 @11:59AM (#58538026) Homepage

    For varying definitions of "developers". Web monkeys rarely deserve that title.

  • by aglider ( 2435074 ) on Saturday May 04, 2019 @12:00PM (#58538030) Homepage

    Next question?

  • I like it. Very easy to use, yet purpose built for large projects. Strong typing without the suck. What I find particularly notable is that it is a really good entirely FOSS project by Microsoft, along with a powerful IDE/Editor built in TS: VS Code.

    As far as transpired JavaScript complementary languages go, TS is the most mature and IMHO the most interesting. Definitely worth a try.

    My 2 cents.

  • by Anonymous Coward

    Typescript is the most widely adopted "transpiled" language. Right now it only runs in "compiled to javascript" form as far as I know. Not bytecode for the Javascript interpreter, Javascript code that has to be run. So even if some higher level syntax is used, Javascript will always be there.

    Wake me up when other languages host an interpreter on top of WebAssembly and give me full access to the DOM and other APIs directly

  • by Anonymous Coward

    ... is proof enough that JS sucks. The entire term was barely mentioned in computer science before JS infected the world's computers. People keep trying to work with JS, without *really* working with it, because they all know it stucks deep down.

    Why can't the big browsers just implement a pluggable script language API, so that languages other than JS can be used in the browser without transpiling? Offer Python, Perl, Go,... whatever sandboxed plugins with the same minimal, browser-centric variant of their s

On the eighth day, God created FORTRAN.

Working...