TypeScript
Introduction
By, Travis van der Font
What is TypeScript?
A language that compiles onto JavaScript
May be used to develop JavaScript applications
for client-side or server-side
• Web browser (client)
• NodeJS (server)
That’s all !
A bit more about TypeScript…
• First appearance: October of 2012 (version 0.8)
• First stable release: January of 2016 (version 1.0)
• License: Apache License 2.0
(permissive free software license)
Can Cannot Must
• Commercial Use
• Modify
• Distribute
• Sub-license
• Private Use
• Place Warranty
• Hold Liable
• Use Trademark
• Include Copyright
• Include License
• State Changes
• Include Notice
A bit more about TypeScript…
• First appearance: October of 2012 (version 0.8)
• First stable release: January of 2016 (version 1.0)
• License: Apache License 2.0
(permissive free software license)
• Created & Developed by: Microsoft
TypeScript compiler itself was written in TypeScript
and then transcompiled into JavaScript.
Technicalities of TypeScript
• Target compatibility with ECMAScript 3 (ES3)
• Strict superset of ECMAScript 2015 (ES5)
• ECMAScript 6 (ES6) support
Technicalities of TypeScript
• Target compatibility with ECMAScript 3 (ES3)
• Strict superset of ECMAScript 2015 (ES5)
• ECMAScript 6 (ES6) support
So what does this mean?
• It’s compatible with most modern browsers
• Supports features many browsers don’t have yet!
Why TypeScript?
• Build large scale applications
• Cross platform
any browser, any host, any OS !
• Static Typing (ʘ‿ʘ)
• Open Source
cost you not to begin creating!
• Compatible with existing libraries / modules
NodeJS, jQuery, Underscore, Backbone, Require, etc..
How does TypeScript work?
• Transpiles from TypeScript syntax into
JavaScript ES5 (JetBrains, Visual Studio, NPM)
contains no runtime cost!
- www.npmjs.com/package/typescript
• Yes you can!
Automatically compile TypeScript to JavaScript
on the fly (in the browser) with Tag Support
- www.github.com/niutech/typescript-compile
- www.github.com/basarat/typescript-script
Core features of TypeScript
• Gradual Typing
Catch errors at compile time vs. runtime
• Object-Oriented features on JavaScript
Syntax sugar - not real OOP (still prototype inheritance)
- Namespaces
- Interfaces
- Classes
- Constructors
- Private & Static fields (not truly denying access but will throw an error)
- Methods (basically a function)
• Retains functional aspects of JavaScript
TypeScript's Typing Support
• Boolean
• Number
• String
• Any
• Array
• Enum
• Void
• Tuple
And now.. that’s all!
Time for some examples.
“It is just JavaScript - just with the seat belt
fastened.” - Tero Parviainen
www.travisfont.com

TypeScript Introduction

  • 1.
  • 2.
    What is TypeScript? Alanguage that compiles onto JavaScript May be used to develop JavaScript applications for client-side or server-side • Web browser (client) • NodeJS (server)
  • 3.
  • 4.
    A bit moreabout TypeScript… • First appearance: October of 2012 (version 0.8) • First stable release: January of 2016 (version 1.0) • License: Apache License 2.0 (permissive free software license) Can Cannot Must • Commercial Use • Modify • Distribute • Sub-license • Private Use • Place Warranty • Hold Liable • Use Trademark • Include Copyright • Include License • State Changes • Include Notice
  • 5.
    A bit moreabout TypeScript… • First appearance: October of 2012 (version 0.8) • First stable release: January of 2016 (version 1.0) • License: Apache License 2.0 (permissive free software license) • Created & Developed by: Microsoft TypeScript compiler itself was written in TypeScript and then transcompiled into JavaScript.
  • 6.
    Technicalities of TypeScript •Target compatibility with ECMAScript 3 (ES3) • Strict superset of ECMAScript 2015 (ES5) • ECMAScript 6 (ES6) support
  • 7.
    Technicalities of TypeScript •Target compatibility with ECMAScript 3 (ES3) • Strict superset of ECMAScript 2015 (ES5) • ECMAScript 6 (ES6) support So what does this mean? • It’s compatible with most modern browsers • Supports features many browsers don’t have yet!
  • 8.
    Why TypeScript? • Buildlarge scale applications • Cross platform any browser, any host, any OS ! • Static Typing (ʘ‿ʘ) • Open Source cost you not to begin creating! • Compatible with existing libraries / modules NodeJS, jQuery, Underscore, Backbone, Require, etc..
  • 9.
    How does TypeScriptwork? • Transpiles from TypeScript syntax into JavaScript ES5 (JetBrains, Visual Studio, NPM) contains no runtime cost! - www.npmjs.com/package/typescript • Yes you can! Automatically compile TypeScript to JavaScript on the fly (in the browser) with Tag Support - www.github.com/niutech/typescript-compile - www.github.com/basarat/typescript-script
  • 10.
    Core features ofTypeScript • Gradual Typing Catch errors at compile time vs. runtime • Object-Oriented features on JavaScript Syntax sugar - not real OOP (still prototype inheritance) - Namespaces - Interfaces - Classes - Constructors - Private & Static fields (not truly denying access but will throw an error) - Methods (basically a function) • Retains functional aspects of JavaScript
  • 11.
    TypeScript's Typing Support •Boolean • Number • String • Any • Array • Enum • Void • Tuple
  • 12.
    And now.. that’sall! Time for some examples. “It is just JavaScript - just with the seat belt fastened.” - Tero Parviainen www.travisfont.com