Close
  • Latest News
  • Artificial Intelligence
  • Video
  • Big Data and Analytics
  • Cloud
  • Networking
  • Cybersecurity
  • Applications
  • IT Management
  • Storage
  • Sponsored
  • Mobile
  • Small Business
  • Development
  • Database
  • Servers
  • Android
  • Apple
  • Innovation
  • Blogs
  • PC Hardware
  • Reviews
  • Search Engines
  • Virtualization
Read Down
Sign in
Close
Welcome!Log into your account
Forgot your password?
Read Down
Password recovery
Recover your password
Close
Search
Logo
Logo
  • Latest News
  • Artificial Intelligence
  • Video
  • Big Data and Analytics
  • Cloud
  • Networking
  • Cybersecurity
  • Applications
  • IT Management
  • Storage
  • Sponsored
  • Mobile
  • Small Business
  • Development
  • Database
  • Servers
  • Android
  • Apple
  • Innovation
  • Blogs
  • PC Hardware
  • Reviews
  • Search Engines
  • Virtualization
More
    Home Development
    • Development

    Microsoft Delivers TypeScript: A Better JavaScript for Big Apps

    Written by

    Darryl K. Taft
    Published October 1, 2012
    Share
    Facebook
    Twitter
    Linkedin

      eWEEK content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

      Microsoft has announced a new programming language, known as TypeScript, which is aimed at being a better JavaScript for building large-scale, enterprise-class applications.

      Microsoft aims to tackle big problems for developers, and taking down one of the major knocks against JavaScript is a big deal. So the company enlisted some big names led by Ander Hejlsberg, father of the C# language, Steve Lucco, creator of Microsoft’s “Chakra” JavaScript engine, and Luke Hoban, a programming language expert now focused on ECMAScript standards and JavaScript development.

      Microsoft has taken strong strides in its development of TypeScript, including ensuring it adheres to ECMAScript standards, making it easy for developers to use, and opening up the language, just to name a few.

      “We want to see what the community has to say,” Hejlsberg said.

      As Soma Somasegar, corporate vice president of Microsoft’s Developer Division, said in a blog post on TypeScript, Microsoft is “introducing a new programming language that solves a very specific problem—getting JavaScript development to scale.” He adds that you can learn more about the TypeScript project, download the bits, read and discuss the language specification, explore the online playground and peruse the source of the compiler on the TypeScript project site on CodePlex.

      Somasegar spells out the Microsoft strategy. “In addition to supporting industry-standard programming languages, such as C++, Python and JavaScript, Microsoft has always been at the forefront of creating great programming languages—Visual Basic, C#, and F# being the most recent examples,” he said. “We create programming languages to solve problems and to enable a broad set of people to build software.”

      Moreover, Somasegar wrote, “During the past five years, JavaScript speed has doubled every nine months (as measured by the WebKit SunSpider JavaScript benchmark). With HTML5, the standard Web platform has become significantly more compelling for delivering rich user experiences. At the same time, the reach of JavaScript has continued to expand, going beyond the browser to include native device apps (e.g. Windows Store apps for Windows 8), applications in the cloud (e.g., node.js running on Windows Azure), and more. With these developments, we’re starting to see applications of unprecedented size written with JavaScript, despite the fact that creating large-scale JavaScript applications is hard. TypeScript makes it easier.”

      Hejlsberg told eWEEK that over the last five years Microsoft has increasingly heard from customers and internal teams that it is increasingly hard to build application-scale JavaScript solutions. And there are several reasons for that, he said. “JavaScript was invented as a scripting language and never really had any of the large-scale code structuring concepts like classes and modules. But also JavaScript is entirely dynamically typed, which means it lacks the static typing information that really is what powers today’s full-featured IDEs [integrated development environments] with things like refactorings and statement completions, find all references, rename, etc.”

      To overcome some of the issues with JavaScript, “developers (including some teams at Microsoft) have taken to using tools like Script# for static typing, jslint and other lint tools for code checking, and the closure compiler to define explicit contracts between components,” Somasegar said. “They’ve also adopted best practices like the module pattern to achieve encapsulation.”

      So two or three years ago when Microsoft was thinking about where to go next with JavaScript development tools, “we thought it would be really valuable if we could strengthen JavaScript with these missing features for application-scale development—classes, modules, static typing—without sacrificing any of the benefits that are inherent to JavaScript—open standards, Web, cross-platform, works anywhere. And that’s what TypeScript is about. It’s basically a language for application-scale JavaScript development. Or if you go the next level down, it is a typed superset of JavaScript that compiles to plain JavaScript. And that JavaScript and the compiler itself works on any browser, on any host, on any OS. And the compiler and any associated language services are all open-source.”

      Indeed, Microsoft says TypeScript starts with JavaScript.

      “All JavaScript code is TypeScript code—you can just copy and paste JavaScript into a TypeScript file,” Hejlsberg said. “And all existing JavaScript frameworks work with TypeScript. So Node.js, jQuery, Underscore.js, Backbone.js, Express, Prototype—there’s a new one every day—all work with TypeScript. On top of that, TypeScript adds optional static types and classes and modules, and those are things that empower tools to be great at application-scale development. But these concepts then compile away. So when you compile TypeScript code, we produce idiomatic JavaScript code—basically the JavaScript code that you would have had to write in order to do class-based programming or in order to do modules. And that final code runs in any browser, in any host, on any OS.”

      In a demo, Hoban showed the TypeScript Playground where you can experiment with TypeScript. He also demonstrated how TypeScript begins with JavaScript, showing how you can add type annotations and classes to JavaScript and how code completion works in the language.

      TypeScript allows us to provide rich tooling experiences, like code completion,” Hoban said. “TypeScript is available as a plug-in for Visual Studio, but it’s also available as an NPM (Node Package Manager), which allows you to run the TypeScript compiler in any environment where Node.js is supported—which includes Mac OS, Linux and Windows. We’ll be providing a plug-in for Visual Studio that provides some of this rich tooling experience inside the Visual Studio 2012 toolset.” Hoban also demonstrated an example of an ASP.NET MVC 3 application leveraging TypeScript and using jQuery.

      But why do Typescript when Google has been working on Dart, which attempts to solve many of the same problems and is championed by Gilad Bracha, who often speaks about the shortcomings of JavaScript. Dart is an open-source Web programming language developed by Google. It was unveiled at the GOTO conference in October 2011. The goal of Dart is “ultimately to replace JavaScript as the lingua franca of Web development on the open Web platform,” Google said. Dart is intended to solve JavaScript’s problems while offering better performance, the ability “to be more easily tooled for large-scale projects” and better security features. Google is also working on Dart to help them build more complex, full-featured client-side Web apps.

      However, TypeScript is a better fit for JavaScript developers, Hejlsberg said. “It’s a completely different design point with completely different design goals,” Hejlsberg told eWEEK. “Dart ultimately is about replacing JavaScript. It’s a new language and a new virtual machine. You can cross-compile to JavaScript, but when you do, you’re basically taking one language’s semantics—the semantics of Dart—and trying to emulate that on JavaScript. Just like Script# or GWT tried to emulate C# or Java on JavaScript. And associated with that is some cost and some complexity.”

      Furthermore, Hejlsberg said all the existing JavaScript libraries out there don’t work with Dart, “unless you cross-compile to JavaScript and unless you first provide some sort of Dart view or encapsulation of these libraries. And this contrasts with TypeScript where, first of all, we start with JavaScript, so you don’t have to go relearn a new language; you just have to learn how to put type annotations on your parameters, and that’s not all that hard to learn. Second, we align extensions with ECMAScript 6, so the classes, modules, etc., that we implement in TypeScript are aligned with where the ECMAScript 6 committee is going with the JavaScript standard. So even learning TypeScript, you’re actually learning what ultimately will be JavaScript. And all of these third-party libraries work with our technology.”

      Meanwhile, TypeScript is open. The TypeScript language is made available under the Open Web Foundation’s OWFa 1.0 Specification Agreement, Somasegar said. “And we invite the community to discuss the language specification,” he added. “Microsoft’s implementation of the compiler is also available on CodePlex under the Apache 2.0 license. There you can view our road map, and over the next few weeks and months you’ll see the TypeScript team continue to develop on CodePlex in the open.”

      Darryl K. Taft
      Darryl K. Taft
      Darryl K. Taft covers the development tools and developer-related issues beat from his office in Baltimore. He has more than 10 years of experience in the business and is always looking for the next scoop. Taft is a member of the Association for Computing Machinery (ACM) and was named 'one of the most active middleware reporters in the world' by The Middleware Co. He also has his own card in the 'Who's Who in Enterprise Java' deck.

      Get the Free Newsletter!

      Subscribe to Daily Tech Insider for top news, trends & analysis

      Get the Free Newsletter!

      Subscribe to Daily Tech Insider for top news, trends & analysis

      MOST POPULAR ARTICLES

      Artificial Intelligence

      9 Best AI 3D Generators You Need...

      Sam Rinko - June 25, 2024 0
      AI 3D Generators are powerful tools for many different industries. Discover the best AI 3D Generators, and learn which is best for your specific use case.
      Read more
      Cloud

      RingCentral Expands Its Collaboration Platform

      Zeus Kerravala - November 22, 2023 0
      RingCentral adds AI-enabled contact center and hybrid event products to its suite of collaboration services.
      Read more
      Artificial Intelligence

      8 Best AI Data Analytics Software &...

      Aminu Abdullahi - January 18, 2024 0
      Learn the top AI data analytics software to use. Compare AI data analytics solutions & features to make the best choice for your business.
      Read more
      Latest News

      Zeus Kerravala on Networking: Multicloud, 5G, and...

      James Maguire - December 16, 2022 0
      I spoke with Zeus Kerravala, industry analyst at ZK Research, about the rapid changes in enterprise networking, as tech advances and digital transformation prompt...
      Read more
      Video

      Datadog President Amit Agarwal on Trends in...

      James Maguire - November 11, 2022 0
      I spoke with Amit Agarwal, President of Datadog, about infrastructure observability, from current trends to key challenges to the future of this rapidly growing...
      Read more
      Logo

      eWeek has the latest technology news and analysis, buying guides, and product reviews for IT professionals and technology buyers. The site’s focus is on innovative solutions and covering in-depth technical content. eWeek stays on the cutting edge of technology news and IT trends through interviews and expert analysis. Gain insight from top innovators and thought leaders in the fields of IT, business, enterprise software, startups, and more.

      Facebook
      Linkedin
      RSS
      Twitter
      Youtube

      Advertisers

      Advertise with TechnologyAdvice on eWeek and our other IT-focused platforms.

      Advertise with Us

      Menu

      • About eWeek
      • Subscribe to our Newsletter
      • Latest News

      Our Brands

      • Privacy Policy
      • Terms
      • About
      • Contact
      • Advertise
      • Sitemap
      • California – Do Not Sell My Information

      Property of TechnologyAdvice.
      © 2024 TechnologyAdvice. All Rights Reserved

      Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.

      ×