• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JavaScript vs TypeScript

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Modern JavaScript is going further beyond just the client side (web browsers). Now you hear about server-side (Node.js) rendering and native mobile apps created with JavaScript.  One of the most difficult things for developers when creating new applications is choosing the most effective way to write JavaScript.  There are many different scripting languages to choose from, such as TypeScript, EMCAScript, AtScript, Dart, or Babel, just to name a few.  TypeScript and EMCAScript, however, seem to be the standout scripting languages applications.

Which scripting language is the is going to make you the most powerful, and to fully accomplish your application’s purpose?  Is it JavaScript or TypeScript?

To me it seems like TypeScript is the way to go now for large applications (client-side or server-side) since TypeScript is a superset of JavaScript, any JavaScript programs are valid TypeScript programs.
 
Author
Posts: 10
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gibran,

I'll shorten your list a bit : Typescript, JavaScript, and Dart. (AtScript has been merged into Typescript, and Babel is just a transpiler that allows us to use new JavaScript features even though the browsers haven't yet implemented them.)

Personally, I don't have experience with Dart (it seems nice, and having Google behind it is always a plus).

As for Typescript, I really like it and my last couple of projects are in Typescript. I find types immensely helpful; they help me catch stupid errors, ease the burden off my memory with code completion, and I can understand code more quickly. When developing larger applications, I'm more productive than with vanilla JavaScript.

For me, a great thing about Typescript is that it really is just JavaScript + types. In addition, if Typescript development stops for some reason, it would be fairly straightforward to develop a transpiler that would clean the Typescript fluff and leave you with pure ES6.

So for now, with a caveat that I still don't have long-lived projects developed in it, I would go with Typescript.

Josip
 
Gibran Castillo
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Josip,

Thank you for the clarification and for expanding.  This is really helpful.


Thanks,
Gibran
 
Gibran Castillo
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Josip,

Are you familiar with EMCAScript (or ES)?

Would you rather use EMCAScript instead of TypeScript?   JavaScript and TypeScript track ES.

Thanks,
Gibran
 
Josip Maras
Author
Posts: 10
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ECMAScript is just the official name for the JavaScript standard, so currently I'm a bit more in favor of expanding my JavaScript with types (using Typescript) than for vanilla JavaScript.
 
author
Posts: 85
5
PHP
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also look into Flow (http://flowtype.org) as an addition to modern ECMAScript that does types for you. You opt-in so you can start adding types to your individual files (modules) one at a time. Pretty amazing what JS looks like these days.
 
Gibran Castillo
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does your book 'Secrets of the JavaScript Ninja 2nd Edition' cover JavaScript with type (TypeScript) and/or VanillaJS (vanilla JavaScript)?

In your book do you cover progressive web apps and service workers (worker script)?
 
Josip Maras
Author
Posts: 10
7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The book mentions Typescript a couple of times, but it doesn't discuss it in details.

However, there's no Typescript without JavaScript (since Typescript adds to JavaScript), so you learn Typescript by learning JavaScript. (Actually, to me it even feels weird to write about them as about two different languages, since Typescript only adds type info to JavaScript). In my opinion you first learn JavaScript (e.g. from the Ninja book), and then you spend an afternoon on https://www.typescriptlang.org/docs/handbook/basic-types.html to learn the additional, Typescript stuff.

Josip
 
Gibran Castillo
Ranch Hand
Posts: 48
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with you and your suggestion.  I look forward to reading your book.  Thanks!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Josip Maras wrote:However, there's no Typescript without JavaScript...



A cow-worthy post! In fact, have two!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic