SlideShare a Scribd company logo
TYPESCRIPT
THE NEXT FRONTIER
It’s JavaScript…
Yep, its TypeScript
It’s a script…?
What isTypeScript and why should we use it?
• TypeScript is a SUPERSET of JavaScript…. But use it respectfully.
• Any JavaScript isValid TypeScript
//JAVASCRIPT
var myString1 = "Hello";
var myString2 = "World!";
var finalString = myString1 + " " + myString2;
//TYPESCRIPT
var myString1 = "Hello";
var myString2 = "World!";
var finalString = myString1 + " " + myString2;
Two Exceptions:
1. JavaScript’s With Statements
2. Vender Specific Extensions – i.e.: Mozilla’s CONST
…..Well sort of
• So what ‘problems’ does TypeScript solve in JavaScript then?
• Prototypal Inheritance
• Management of Modules (namespaces)
• Scoping
• Lack ofTypes
3
What isTypeScript and why should we use it?
4
var FelineSoft;
(function (FelineSoft) {
var Employee = (function () {
function Employee(options) {
this.firstName = options.firstName;
this.lastName = options.lastName;
this.payType = options.payType;
this.payRate = options.payRate;
this.title = options.title || "";
}
Employee.prototype.calculatePay = function (hoursWorked) {
if (this.payType === PayType.Hourly) {
var pay = new Pay();
return pay.calculatePay(hoursWorked, this.payRate);
}
else {
return this.payRate;
}
};
Employee.prototype.fireThem = function () {
return this.firstName + " " + this.lastName + ", you are FIRED!";
};
return Employee;
})();
FelineSoft.Employee = Employee;
var Pay = (function () {
function Pay() { }
Pay.prototype.calculatePay = function (hours, poundsPerHour) {
return hours * poundsPerHour; };
return Pay;
})();
var PayType;
(function (PayType) {
PayType[PayType["Hourly"] = 0] = "Hourly";
PayType[PayType["Salary"] = 1] = "Salary";
})(PayType || (PayType = {}));
})(FelineSoft || (FelineSoft = {}));
namespace FelineSoft {
export class Employee {
private firstName: string;
private lastName: string;
private payType: PayType;
private payRate: number;
private title: string;
constructor(options: IEmployeOptions) {
this.firstName = options.firstName;
this.lastName = options.lastName;
this.payType = options.payType;
this.payRate = options.payRate;
this.title = options.title || "";
}
calculatePay(hoursWorked: number): number {
if (this.payType === PayType.Hourly) {
const pay = new Pay();
return pay.calculatePay(hoursWorked, this.payRate);
}
else { return this.payRate; }
}
fireThem(): string {
return this.firstName + " " + this.lastName + ", you are FIRED!";
}
}
class Pay {
calculatePay(hours: number, poundsPerHour: number): number {
return hours * poundsPerHour;
}
}
enum PayType {
Hourly = 0,
Salary = 1
}
// DOES NOT CONVERT TO JAVASCRIPT
export interface IEmployeOptions {
firstName: string;
lastName: string;
payType: PayType;
payRate: number;
title?: string;
}
}
TypeScript andVisual Studio
5
• TypeScript – Kind of Important (CurrentVersion 1.8.4)
TypeScript andVisual Studio
6
• Web Essentials (CurrentVersion 2015.1)
TypeScript andVisual Studio
7
• BasicVisual Studio Settings forTypeScript
TypeScript andVisual Studio
8
TypeScript andVisual Studio
9
TypeScript andVisual Studio
10
TheTypeScript Basics
11
Variables
• The First Character must be:
• Uppercase Letter
• Lowercase Letter
• Underscore
• Dollar Sign <= Warning
• Reserved Words
var ThisIsValid;
var thisIsValid;
var _andthisIsValid;
var $AlsoValid;
break case catch class const continue debugger default delete do else enum export
extends false finally for function if import in instanceof new null return super
switch this throw true try typeof var void while with implements interface let package
private protected public static yield any boolean number string symbol abstract as
async await constructor declare from get is module namespace of require set type
TheTypeScript Basics
12
Types
namespace Presentation {
var badGlobalVariable;
var goodGlobalString: string;
export class BadClass {
classVariable;
}
export class GoodClass {
classString: string;
}
}
var Presentation;
(function (Presentation) {
var badGlobalVariable;
var goodGlobalString;
var BadClass = (function () {
function BadClass() {
}
return BadClass;
})();
Presentation.BadClass = BadClass;
var GoodClass = (function () {
function GoodClass() {
}
return GoodClass;
})();
Presentation.GoodClass = GoodClass;
})(Presentation || (Presentation = {}));
• Declaring a type is optional, but then you defeat the point of using TypeScript
• To declare a type, use this syntax:
• In a namespace/module
• var myString: string;
• In a class
• myString: string;
• What types are available in TypeScript?
• Strings
• Booleans
• Numbers (all numbers, integers, decimals, floats, etc.)
• Objects
• Arrays
• Enumerations / Bit Flags
• Any
TheTypeScript Basics
13
Operations
• Increment / Decrement : ++ / --
• Math: + - * / %
• String to Number Converter: +string or –string
• Bit Wise: << >> >>> & ^ | ~
• Not Operator: ! !!
• And Operator: &&
• Or Operator: ||
• Type Operator: typeof instanceof in delete
namespace Presentation {
export class Foo {
myString: string = "1";
myNumber: number = 1;
addStringAndNumber(): number {
return this.myNumber + +this.myString;
}
subtractStringAndNumber(): number {
return this.myNumber - +this.myString;
}
}
}
namespace Presentation {
export class Foo {
truthyString: string = 'Truthy string';
falseyString: string;
test(): void {
// False, it checks the string but inverts the truth
var invertedTest = !this.truthyString;
// True, the string is not undefined or empty
var truthyTest = !!this.truthyString;
// False, the string is empty
var falseyTest = !!this.falseyString;
}
}
}
TheTypeScript Basics
14
Functions
• Functions are just Methods
• Inside a class, just the name
• Outside a class, you must include the keyword ‘function’
• Parameters
• Optional Parameters
• Default Parameters
• Rest Parameters
• Overloads
• Arrow Functions
• Return Values
namespace Presentation {
export class Foo {
myClassMethod(): void {
//DO SOMETHING
}
}
function myGlobalFunction(): void {
//DO SOMETHING
}
}
namespace Presentation {
export class Foo {
getString(): string {
return "Hello World!";
}
getNumber(): number {
return 1;
}
getNothing(): void {
// HA HA HA, nothing to return
}
}
}
namespace Presentation {
export class Foo {
getAverage(a: string, b: string, c: string): string;
getAverage(a: number, b: number, c: number): string;
getAverage(a: any, b: any, c: any): string {
var total = parseInt(a, 10) + parseInt(b, 10) + parseInt(c, 10);
var average = total / 3;
return `The average is ${average}`;
}
}
}
namespace Presentation {
export class Foo {
methodWithOptionalParams(param?: string): void {
//DO SOMETHING
}
methodWithDefaultParams(param: string = "default"): void {
//DO SOMETHING
}
methodWithRestParams(...param: string[]): void {
//DO SOMETHING
}
}
}
TheTypeScript Basics
15
NameSpaces
• Namespaces used to be referred to as Modules
• Namespaces can be nested
• Top level namespaces do not need to be mark for export
• Anything accessed by something outside of its parent
namespace must be marked for export
namespace Presentation {
export class MyClass {
myString: string;
myNumber: number;
constructor() {
this.myString = "Hello World!";
this.myNumber = 42;
}
}
}
namespace Level1 {
namespace Level2a {
export class L2aClass {
}
Level1.Level2b.L2bClass // ACCESSABLE
}
export namespace Level2b {
export class L2bClass {
}
Level1.level2a.L2aClass // NOT ACCESSABLE
}
}
namespace LevelA {
Level1.Level2a.L2aClass // NOT ACCESSABLE
Level1.Level2b.L2bClass // ACCESSABLE
}
module Presentation {
export class MyClass {
myString: string;
myNumber: number;
constructor() {
this.myString = "Hello World!";
this.myNumber = 42;
}
}
}
TheTypeScript Basics
16
Interfaces
• Interfaces are used solely by TypeScript, no JavaScript is created
• Interfaces can be used model an ‘virtual object’
• Interfaces can use Inheritance
• Interfaces are just Interfaces
• But they support optional fields
• Interfaces support Generics
• Type Constraints can be used using EXTENDS
namespace Presentation {
interface ICar {
engine: string;
color: string;
}
class Car implements ICar {
constructor(engine: string, color: string) {
this.engine = engine;
this.color = color;
}
engine: string;
color: string;
}
}
namespace Presentation {
interface ICar {
engine: string;
color: string;
}
class Car implements ICar {
constructor(data: ICar) {
this.engine = data.engine;
this.color = data.color;
}
engine: string;
color: string;
}
var myCar = new Car({ engine : "FAST", color : "BLACK" });
}
TheTypeScript Basics
17
Interfaces
namespace Presentation {
interface IEngine {
type: string;
}
interface ICar<T extends IEngine> {
engine: T;
color: string;
}
class SlowEngine implements IEngine {
type = "slow :(";
}
class FastEngine implements IEngine {
type = "FAST :)";
}
class MySlowCar implements ICar<SlowEngine> {
engine: SlowEngine;
color: string;
}
class MyFastCar implements ICar<FastEngine> {
engine: FastEngine;
color: string;
}
}
namespace Presentation {
interface ICar {
engine: string;
color: string;
}
interface IBasicCar extends ICar {
doors: number;
}
class Car implements IBasicCar {
constructor(engine: string, color: string, doors: number) {
this.engine = engine;
this.color = color;
this.doors = doors;
}
engine: string;
color: string;
doors: number;
}
}
TheTypeScript Basics
18
Classes
• Constructors use the keyword, constructor, and never have a return type
• Classes have Fields, Properties and Methods
• Access Modifiers can be used but ONLY apply within TypeScript
• Classes can use Inheritances
• Classes IMPLEMENTS interfaces
• Classes EXTENDS other classes
• Classes support Generics
• Type Constraints can be used
namespace Presentation {
class MyClass {
constructor() {
}
}
}
namespace Presentation {
class MyClass {
private _value: string;
constructor() {
}
myField: string;
myMethod(): void {
//DO SOME WORK HERE
}
get value() {
return this._value;
}
set value(item: string) {
this._value = item;
}
}
}
namespace Presentation {
class MyClass {
constructor() {
}
private myPrivateProperty: string;
public myPublicProperty: string;
protected myProtectedProperty: string;
public myPublicMethod(): void {
//DO SOME WORK FOR ANYONE
}
private myPrivateMethod(): void {
// DO SOME INTERNAL WORK
}
protected myProtectedMethod(): void {
// DO SOME WORK FOR MY FRIEND
}
}
}
TheTypeScript Basics
19
Classes
namespace Presentation {
class MyClass<T> {
private id: T;
constructor(id: T) {
this.id = id;
}
myId(): T {
return this.id;
}
}
}
namespace Presentation {
class MyClass {
constructor() {
}
private myPrivateProperty: string;
public myPublicProperty: string;
protected myProtectedProperty: string;
public myPublicMethod(): void {
//DO SOME WORK FOR ANYONE
}
private myPrivateMethod(): void {
// DO SOME INTERNAL WORK
}
protected myProtectedMethod(): void {
// DO SOME WORK FOR MY FRIEND
}
}
class ChildClass extends MyClass {
constructor() {
super();
this.myProtectedMethod(); // ACCESSABLE
this.myProtectedProperty = ""; // ACCESSABLE
this.myPrivateMethod(); // NOT ACCESSABLE
this.myPrivateProperty = ""; // NOT ACCESSABLE
}
}
}
TypeScript:The Advance Stuff 
20
IsThere More?
• Anything written in JavaScript, can be written in TypeScript
• .NET Core
• Node.js
• Node Package Manager
• Etc etc etc etc
• Async/Await - New
• Most common JavaScript Frameworks have a Type Definition
• If not, you can create one
function getStringFromWebServerAsync() {
return new Promise<string>((resolve, reject) => {
$.get("http://localhost/GetAString")
.done((data) => {
resolve(data);
})
.fail((err) => {
reject(err);
});
});
}
async function asyncExample() {
try {
let data = await getStringFromWebServerAsync();
console.log(data);
}
catch (err) {
console.log(err);
}
}
asyncExample();
Links
21
• https://en.wikipedia.org/wiki/TypeScript
• http://www.typescriptlang.org/
• http://vswebessentials.com/
• https://github.com/DefinitelyTyped/DefinitelyTyped
Code Demo

More Related Content

What's hot

Deriving Scalaz
Deriving ScalazDeriving Scalaz
Deriving Scalaz
nkpart
 
How do you create a programming language for the JVM?
How do you create a programming language for the JVM?How do you create a programming language for the JVM?
How do you create a programming language for the JVM?
Federico Tomassetti
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
Dmitry Sheiko
 
Functional programming in kotlin with Arrow [Sunnytech 2018]
Functional programming in kotlin with Arrow [Sunnytech 2018]Functional programming in kotlin with Arrow [Sunnytech 2018]
Functional programming in kotlin with Arrow [Sunnytech 2018]
Emmanuel Nhan
 
Scalaz
ScalazScalaz
Scalaz
mpilquist
 
Kotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsKotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrains
Jigar Gosar
 
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsQuark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
John De Goes
 
Intro to Functional Programming in Scala
Intro to Functional Programming in ScalaIntro to Functional Programming in Scala
Intro to Functional Programming in Scala
Shai Yallin
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: Rebirth
John De Goes
 
Functional Programming Patterns for the Pragmatic Programmer
Functional Programming Patterns for the Pragmatic ProgrammerFunctional Programming Patterns for the Pragmatic Programmer
Functional Programming Patterns for the Pragmatic Programmer
Raúl Raja Martínez
 
Scalaz 8: A Whole New Game
Scalaz 8: A Whole New GameScalaz 8: A Whole New Game
Scalaz 8: A Whole New Game
John De Goes
 
Swift in SwiftUI
Swift in SwiftUISwift in SwiftUI
Swift in SwiftUI
Bongwon Lee
 
The Death of Final Tagless
The Death of Final TaglessThe Death of Final Tagless
The Death of Final Tagless
John De Goes
 
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Ruslan Shevchenko
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class Patterns
John De Goes
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
Damian Jureczko
 
Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And Monad
Oliver Daff
 
Practical scalaz
Practical scalazPractical scalaz
Practical scalaz
oxbow_lakes
 
Post-Free: Life After Free Monads
Post-Free: Life After Free MonadsPost-Free: Life After Free Monads
Post-Free: Life After Free Monads
John De Goes
 
Refactoring Functional Type Classes
Refactoring Functional Type ClassesRefactoring Functional Type Classes
Refactoring Functional Type Classes
John De Goes
 

What's hot (20)

Deriving Scalaz
Deriving ScalazDeriving Scalaz
Deriving Scalaz
 
How do you create a programming language for the JVM?
How do you create a programming language for the JVM?How do you create a programming language for the JVM?
How do you create a programming language for the JVM?
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Functional programming in kotlin with Arrow [Sunnytech 2018]
Functional programming in kotlin with Arrow [Sunnytech 2018]Functional programming in kotlin with Arrow [Sunnytech 2018]
Functional programming in kotlin with Arrow [Sunnytech 2018]
 
Scalaz
ScalazScalaz
Scalaz
 
Kotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsKotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrains
 
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsQuark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
 
Intro to Functional Programming in Scala
Intro to Functional Programming in ScalaIntro to Functional Programming in Scala
Intro to Functional Programming in Scala
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: Rebirth
 
Functional Programming Patterns for the Pragmatic Programmer
Functional Programming Patterns for the Pragmatic ProgrammerFunctional Programming Patterns for the Pragmatic Programmer
Functional Programming Patterns for the Pragmatic Programmer
 
Scalaz 8: A Whole New Game
Scalaz 8: A Whole New GameScalaz 8: A Whole New Game
Scalaz 8: A Whole New Game
 
Swift in SwiftUI
Swift in SwiftUISwift in SwiftUI
Swift in SwiftUI
 
The Death of Final Tagless
The Death of Final TaglessThe Death of Final Tagless
The Death of Final Tagless
 
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class Patterns
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
 
Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And Monad
 
Practical scalaz
Practical scalazPractical scalaz
Practical scalaz
 
Post-Free: Life After Free Monads
Post-Free: Life After Free MonadsPost-Free: Life After Free Monads
Post-Free: Life After Free Monads
 
Refactoring Functional Type Classes
Refactoring Functional Type ClassesRefactoring Functional Type Classes
Refactoring Functional Type Classes
 

Similar to TypeScript Presentation - Jason Haffey

TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
felixbillon
 
Rits Brown Bag - TypeScript
Rits Brown Bag - TypeScriptRits Brown Bag - TypeScript
Rits Brown Bag - TypeScript
Right IT Services
 
All You Need to Know About Type Script
All You Need to Know About Type ScriptAll You Need to Know About Type Script
All You Need to Know About Type Script
Folio3 Software
 
The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)
jeresig
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
Garth Gilmour
 
Type script, for dummies
Type script, for dummiesType script, for dummies
Type script, for dummies
santiagoaguiar
 
Einführung in TypeScript
Einführung in TypeScriptEinführung in TypeScript
Einführung in TypeScript
Demian Holderegger
 
Programming with Java: the Basics
Programming with Java: the BasicsProgramming with Java: the Basics
Programming with Java: the BasicsJussi Pohjolainen
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy codeShriKant Vashishtha
 
Deep Dive Into Swift
Deep Dive Into SwiftDeep Dive Into Swift
Deep Dive Into Swift
Sarath C
 
The Swift Compiler and Standard Library
The Swift Compiler and Standard LibraryThe Swift Compiler and Standard Library
The Swift Compiler and Standard Library
Santosh Rajan
 
C++ Function
C++ FunctionC++ Function
C++ FunctionHajar
 
Quick swift tour
Quick swift tourQuick swift tour
Quick swift tour
Kazunobu Tasaka
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
Guy Komari
 
C++ theory
C++ theoryC++ theory
C++ theory
Shyam Khant
 
From android/java to swift (3)
From android/java to swift (3)From android/java to swift (3)
From android/java to swift (3)
allanh0526
 
Back to the Future with TypeScript
Back to the Future with TypeScriptBack to the Future with TypeScript
Back to the Future with TypeScript
Aleš Najmann
 
Type script by Howard
Type script by HowardType script by Howard
Type script by Howard
LearningTech
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
Siarhei Barysiuk
 

Similar to TypeScript Presentation - Jason Haffey (20)

TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
 
Rits Brown Bag - TypeScript
Rits Brown Bag - TypeScriptRits Brown Bag - TypeScript
Rits Brown Bag - TypeScript
 
All You Need to Know About Type Script
All You Need to Know About Type ScriptAll You Need to Know About Type Script
All You Need to Know About Type Script
 
The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
 
Type script, for dummies
Type script, for dummiesType script, for dummies
Type script, for dummies
 
Einführung in TypeScript
Einführung in TypeScriptEinführung in TypeScript
Einführung in TypeScript
 
Programming with Java: the Basics
Programming with Java: the BasicsProgramming with Java: the Basics
Programming with Java: the Basics
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy code
 
Deep Dive Into Swift
Deep Dive Into SwiftDeep Dive Into Swift
Deep Dive Into Swift
 
The Swift Compiler and Standard Library
The Swift Compiler and Standard LibraryThe Swift Compiler and Standard Library
The Swift Compiler and Standard Library
 
Core C#
Core C#Core C#
Core C#
 
C++ Function
C++ FunctionC++ Function
C++ Function
 
Quick swift tour
Quick swift tourQuick swift tour
Quick swift tour
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
C++ theory
C++ theoryC++ theory
C++ theory
 
From android/java to swift (3)
From android/java to swift (3)From android/java to swift (3)
From android/java to swift (3)
 
Back to the Future with TypeScript
Back to the Future with TypeScriptBack to the Future with TypeScript
Back to the Future with TypeScript
 
Type script by Howard
Type script by HowardType script by Howard
Type script by Howard
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
 

More from Ralph Johnson

Agile process with a fixed cost
Agile process with a fixed costAgile process with a fixed cost
Agile process with a fixed cost
Ralph Johnson
 
Preventing sprint overun with good user stories
Preventing sprint overun with good user storiesPreventing sprint overun with good user stories
Preventing sprint overun with good user stories
Ralph Johnson
 
100% browser based audio video calling
100% browser based audio video calling100% browser based audio video calling
100% browser based audio video calling
Ralph Johnson
 
How to choose a web or bespoke development company
How to choose a web or bespoke development companyHow to choose a web or bespoke development company
How to choose a web or bespoke development company
Ralph Johnson
 
Tech Smart - How to improve member experience
Tech Smart - How to improve member experienceTech Smart - How to improve member experience
Tech Smart - How to improve member experience
Ralph Johnson
 
Growing Felinesoft
Growing FelinesoftGrowing Felinesoft
Growing Felinesoft
Ralph Johnson
 

More from Ralph Johnson (7)

Agile process with a fixed cost
Agile process with a fixed costAgile process with a fixed cost
Agile process with a fixed cost
 
Preventing sprint overun with good user stories
Preventing sprint overun with good user storiesPreventing sprint overun with good user stories
Preventing sprint overun with good user stories
 
100% browser based audio video calling
100% browser based audio video calling100% browser based audio video calling
100% browser based audio video calling
 
How to choose a web or bespoke development company
How to choose a web or bespoke development companyHow to choose a web or bespoke development company
How to choose a web or bespoke development company
 
Tech Smart - How to improve member experience
Tech Smart - How to improve member experienceTech Smart - How to improve member experience
Tech Smart - How to improve member experience
 
Growing Felinesoft
Growing FelinesoftGrowing Felinesoft
Growing Felinesoft
 
FelineSoft work
FelineSoft workFelineSoft work
FelineSoft work
 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 

TypeScript Presentation - Jason Haffey

  • 2. It’s JavaScript… Yep, its TypeScript It’s a script…?
  • 3. What isTypeScript and why should we use it? • TypeScript is a SUPERSET of JavaScript…. But use it respectfully. • Any JavaScript isValid TypeScript //JAVASCRIPT var myString1 = "Hello"; var myString2 = "World!"; var finalString = myString1 + " " + myString2; //TYPESCRIPT var myString1 = "Hello"; var myString2 = "World!"; var finalString = myString1 + " " + myString2; Two Exceptions: 1. JavaScript’s With Statements 2. Vender Specific Extensions – i.e.: Mozilla’s CONST …..Well sort of • So what ‘problems’ does TypeScript solve in JavaScript then? • Prototypal Inheritance • Management of Modules (namespaces) • Scoping • Lack ofTypes 3
  • 4. What isTypeScript and why should we use it? 4 var FelineSoft; (function (FelineSoft) { var Employee = (function () { function Employee(options) { this.firstName = options.firstName; this.lastName = options.lastName; this.payType = options.payType; this.payRate = options.payRate; this.title = options.title || ""; } Employee.prototype.calculatePay = function (hoursWorked) { if (this.payType === PayType.Hourly) { var pay = new Pay(); return pay.calculatePay(hoursWorked, this.payRate); } else { return this.payRate; } }; Employee.prototype.fireThem = function () { return this.firstName + " " + this.lastName + ", you are FIRED!"; }; return Employee; })(); FelineSoft.Employee = Employee; var Pay = (function () { function Pay() { } Pay.prototype.calculatePay = function (hours, poundsPerHour) { return hours * poundsPerHour; }; return Pay; })(); var PayType; (function (PayType) { PayType[PayType["Hourly"] = 0] = "Hourly"; PayType[PayType["Salary"] = 1] = "Salary"; })(PayType || (PayType = {})); })(FelineSoft || (FelineSoft = {})); namespace FelineSoft { export class Employee { private firstName: string; private lastName: string; private payType: PayType; private payRate: number; private title: string; constructor(options: IEmployeOptions) { this.firstName = options.firstName; this.lastName = options.lastName; this.payType = options.payType; this.payRate = options.payRate; this.title = options.title || ""; } calculatePay(hoursWorked: number): number { if (this.payType === PayType.Hourly) { const pay = new Pay(); return pay.calculatePay(hoursWorked, this.payRate); } else { return this.payRate; } } fireThem(): string { return this.firstName + " " + this.lastName + ", you are FIRED!"; } } class Pay { calculatePay(hours: number, poundsPerHour: number): number { return hours * poundsPerHour; } } enum PayType { Hourly = 0, Salary = 1 } // DOES NOT CONVERT TO JAVASCRIPT export interface IEmployeOptions { firstName: string; lastName: string; payType: PayType; payRate: number; title?: string; } }
  • 5. TypeScript andVisual Studio 5 • TypeScript – Kind of Important (CurrentVersion 1.8.4)
  • 6. TypeScript andVisual Studio 6 • Web Essentials (CurrentVersion 2015.1)
  • 7. TypeScript andVisual Studio 7 • BasicVisual Studio Settings forTypeScript
  • 11. TheTypeScript Basics 11 Variables • The First Character must be: • Uppercase Letter • Lowercase Letter • Underscore • Dollar Sign <= Warning • Reserved Words var ThisIsValid; var thisIsValid; var _andthisIsValid; var $AlsoValid; break case catch class const continue debugger default delete do else enum export extends false finally for function if import in instanceof new null return super switch this throw true try typeof var void while with implements interface let package private protected public static yield any boolean number string symbol abstract as async await constructor declare from get is module namespace of require set type
  • 12. TheTypeScript Basics 12 Types namespace Presentation { var badGlobalVariable; var goodGlobalString: string; export class BadClass { classVariable; } export class GoodClass { classString: string; } } var Presentation; (function (Presentation) { var badGlobalVariable; var goodGlobalString; var BadClass = (function () { function BadClass() { } return BadClass; })(); Presentation.BadClass = BadClass; var GoodClass = (function () { function GoodClass() { } return GoodClass; })(); Presentation.GoodClass = GoodClass; })(Presentation || (Presentation = {})); • Declaring a type is optional, but then you defeat the point of using TypeScript • To declare a type, use this syntax: • In a namespace/module • var myString: string; • In a class • myString: string; • What types are available in TypeScript? • Strings • Booleans • Numbers (all numbers, integers, decimals, floats, etc.) • Objects • Arrays • Enumerations / Bit Flags • Any
  • 13. TheTypeScript Basics 13 Operations • Increment / Decrement : ++ / -- • Math: + - * / % • String to Number Converter: +string or –string • Bit Wise: << >> >>> & ^ | ~ • Not Operator: ! !! • And Operator: && • Or Operator: || • Type Operator: typeof instanceof in delete namespace Presentation { export class Foo { myString: string = "1"; myNumber: number = 1; addStringAndNumber(): number { return this.myNumber + +this.myString; } subtractStringAndNumber(): number { return this.myNumber - +this.myString; } } } namespace Presentation { export class Foo { truthyString: string = 'Truthy string'; falseyString: string; test(): void { // False, it checks the string but inverts the truth var invertedTest = !this.truthyString; // True, the string is not undefined or empty var truthyTest = !!this.truthyString; // False, the string is empty var falseyTest = !!this.falseyString; } } }
  • 14. TheTypeScript Basics 14 Functions • Functions are just Methods • Inside a class, just the name • Outside a class, you must include the keyword ‘function’ • Parameters • Optional Parameters • Default Parameters • Rest Parameters • Overloads • Arrow Functions • Return Values namespace Presentation { export class Foo { myClassMethod(): void { //DO SOMETHING } } function myGlobalFunction(): void { //DO SOMETHING } } namespace Presentation { export class Foo { getString(): string { return "Hello World!"; } getNumber(): number { return 1; } getNothing(): void { // HA HA HA, nothing to return } } } namespace Presentation { export class Foo { getAverage(a: string, b: string, c: string): string; getAverage(a: number, b: number, c: number): string; getAverage(a: any, b: any, c: any): string { var total = parseInt(a, 10) + parseInt(b, 10) + parseInt(c, 10); var average = total / 3; return `The average is ${average}`; } } } namespace Presentation { export class Foo { methodWithOptionalParams(param?: string): void { //DO SOMETHING } methodWithDefaultParams(param: string = "default"): void { //DO SOMETHING } methodWithRestParams(...param: string[]): void { //DO SOMETHING } } }
  • 15. TheTypeScript Basics 15 NameSpaces • Namespaces used to be referred to as Modules • Namespaces can be nested • Top level namespaces do not need to be mark for export • Anything accessed by something outside of its parent namespace must be marked for export namespace Presentation { export class MyClass { myString: string; myNumber: number; constructor() { this.myString = "Hello World!"; this.myNumber = 42; } } } namespace Level1 { namespace Level2a { export class L2aClass { } Level1.Level2b.L2bClass // ACCESSABLE } export namespace Level2b { export class L2bClass { } Level1.level2a.L2aClass // NOT ACCESSABLE } } namespace LevelA { Level1.Level2a.L2aClass // NOT ACCESSABLE Level1.Level2b.L2bClass // ACCESSABLE } module Presentation { export class MyClass { myString: string; myNumber: number; constructor() { this.myString = "Hello World!"; this.myNumber = 42; } } }
  • 16. TheTypeScript Basics 16 Interfaces • Interfaces are used solely by TypeScript, no JavaScript is created • Interfaces can be used model an ‘virtual object’ • Interfaces can use Inheritance • Interfaces are just Interfaces • But they support optional fields • Interfaces support Generics • Type Constraints can be used using EXTENDS namespace Presentation { interface ICar { engine: string; color: string; } class Car implements ICar { constructor(engine: string, color: string) { this.engine = engine; this.color = color; } engine: string; color: string; } } namespace Presentation { interface ICar { engine: string; color: string; } class Car implements ICar { constructor(data: ICar) { this.engine = data.engine; this.color = data.color; } engine: string; color: string; } var myCar = new Car({ engine : "FAST", color : "BLACK" }); }
  • 17. TheTypeScript Basics 17 Interfaces namespace Presentation { interface IEngine { type: string; } interface ICar<T extends IEngine> { engine: T; color: string; } class SlowEngine implements IEngine { type = "slow :("; } class FastEngine implements IEngine { type = "FAST :)"; } class MySlowCar implements ICar<SlowEngine> { engine: SlowEngine; color: string; } class MyFastCar implements ICar<FastEngine> { engine: FastEngine; color: string; } } namespace Presentation { interface ICar { engine: string; color: string; } interface IBasicCar extends ICar { doors: number; } class Car implements IBasicCar { constructor(engine: string, color: string, doors: number) { this.engine = engine; this.color = color; this.doors = doors; } engine: string; color: string; doors: number; } }
  • 18. TheTypeScript Basics 18 Classes • Constructors use the keyword, constructor, and never have a return type • Classes have Fields, Properties and Methods • Access Modifiers can be used but ONLY apply within TypeScript • Classes can use Inheritances • Classes IMPLEMENTS interfaces • Classes EXTENDS other classes • Classes support Generics • Type Constraints can be used namespace Presentation { class MyClass { constructor() { } } } namespace Presentation { class MyClass { private _value: string; constructor() { } myField: string; myMethod(): void { //DO SOME WORK HERE } get value() { return this._value; } set value(item: string) { this._value = item; } } } namespace Presentation { class MyClass { constructor() { } private myPrivateProperty: string; public myPublicProperty: string; protected myProtectedProperty: string; public myPublicMethod(): void { //DO SOME WORK FOR ANYONE } private myPrivateMethod(): void { // DO SOME INTERNAL WORK } protected myProtectedMethod(): void { // DO SOME WORK FOR MY FRIEND } } }
  • 19. TheTypeScript Basics 19 Classes namespace Presentation { class MyClass<T> { private id: T; constructor(id: T) { this.id = id; } myId(): T { return this.id; } } } namespace Presentation { class MyClass { constructor() { } private myPrivateProperty: string; public myPublicProperty: string; protected myProtectedProperty: string; public myPublicMethod(): void { //DO SOME WORK FOR ANYONE } private myPrivateMethod(): void { // DO SOME INTERNAL WORK } protected myProtectedMethod(): void { // DO SOME WORK FOR MY FRIEND } } class ChildClass extends MyClass { constructor() { super(); this.myProtectedMethod(); // ACCESSABLE this.myProtectedProperty = ""; // ACCESSABLE this.myPrivateMethod(); // NOT ACCESSABLE this.myPrivateProperty = ""; // NOT ACCESSABLE } } }
  • 20. TypeScript:The Advance Stuff  20 IsThere More? • Anything written in JavaScript, can be written in TypeScript • .NET Core • Node.js • Node Package Manager • Etc etc etc etc • Async/Await - New • Most common JavaScript Frameworks have a Type Definition • If not, you can create one function getStringFromWebServerAsync() { return new Promise<string>((resolve, reject) => { $.get("http://localhost/GetAString") .done((data) => { resolve(data); }) .fail((err) => { reject(err); }); }); } async function asyncExample() { try { let data = await getStringFromWebServerAsync(); console.log(data); } catch (err) { console.log(err); } } asyncExample();
  • 21. Links 21 • https://en.wikipedia.org/wiki/TypeScript • http://www.typescriptlang.org/ • http://vswebessentials.com/ • https://github.com/DefinitelyTyped/DefinitelyTyped

Editor's Notes

  1. Welcome Ask who feels comfortable in JS Ask who has heard of TS? Ask who has used TS?
  2. What is TypeScript? TS is a free and open source programming language developed and maintained by MS First made public in October of 2012 with version 0.8 Current Version is 1.8.2 Language Features Type Annotations / Compile-Time Type Checking Type Interfaces Type erasure Interfaces Enumerated Type Mixins Generics Scoping Namespaces Tuples Awaits Classes Modules “Arrow” syntax (Anonymous functions) Optional parameters and default parameters IDE/Editor Support VS 2012 has a plug-in available VS 2013 and above TS support is built in Additional Support/Plug-ins ReSharper 8.1 NetBeans IDE Eclipse IDE Sublime
  3. TypeScript is a Superset of JavaScript which means anything you can do in JavaScript you can do in TypeScript, BUT that would defeat the purpose of using TS This means any JS you write is valid TS With 2 exceptions JS With Statements do not transfer over Its like a C# Using Statement from what I understand But Even JS suggests not using it Any Vender Specific Extensions Example is Mozilla’s CONST Syntax There are things called Type Definitions which we will get too later What Problems, if any, does TS solve in JS? Making your code Type Strict….sort of (explain) Continues on next slide
  4. Extensions – Tools > Extensions and Updates TypeScript (Required) Web Essentials (optional) VS TS Settings – Tools > Options OR Quick Search > Typescript Text Editor > TypeScript General – Enable virtual space Project – Display Virtual Projects > Display VP when Solution is loaded | Optional Display VP when no Solution is loaded Project – Compile on Save > Use AMD Project – ECMAScript Version > Use ECMAScript 6 Web Essentials > Code Generation Add TypeScript Reference > TRUE Project Properties – TypeScript Build ALL OF IT!
  5. Extensions – Tools > Extensions and Updates TypeScript (Required) Web Essentials (optional) VS TS Settings – Tools > Options OR Quick Search > Typescript Text Editor > TypeScript General – Enable virtual space Project – Display Virtual Projects > Display VP when Solution is loaded | Optional Display VP when no Solution is loaded Project – Compile on Save > Use AMD Project – ECMAScript Version > Use ECMAScript 6 Web Essentials > Code Generation Add TypeScript Reference > TRUE Project Properties – TypeScript Build ALL OF IT!
  6. Extensions – Tools > Extensions and Updates TypeScript (Required) Web Essentials (optional) VS TS Settings – Tools > Options OR Quick Search > Typescript Text Editor > TypeScript General – Enable virtual space Project – Display Virtual Projects > Display VP when Solution is loaded | Optional Display VP when no Solution is loaded Project – Compile on Save > Use AMD Project – ECMAScript Version > Use ECMAScript 6 Web Essentials > Code Generation Add TypeScript Reference > TRUE Project Properties – TypeScript Build ALL OF IT!
  7. Extensions – Tools > Extensions and Updates TypeScript (Required) Web Essentials (optional) VS TS Settings – Tools > Options OR Quick Search > Typescript Text Editor > TypeScript General – Enable virtual space Project – Display Virtual Projects > Display VP when Solution is loaded | Optional Display VP when no Solution is loaded Project – Compile on Save > Use AMD Project – ECMAScript Version > Use ECMAScript 6 Web Essentials > Code Generation Add TypeScript Reference > TRUE Project Properties – TypeScript Build ALL OF IT!
  8. Extensions – Tools > Extensions and Updates TypeScript (Required) Web Essentials (optional) VS TS Settings – Tools > Options OR Quick Search > Typescript Text Editor > TypeScript General – Enable virtual space Project – Display Virtual Projects > Display VP when Solution is loaded | Optional Display VP when no Solution is loaded Project – Compile on Save > Use AMD Project – ECMAScript Version > Use ECMAScript 6 Web Essentials > Code Generation Add TypeScript Reference > TRUE Project Properties – TypeScript Build ALL OF IT!
  9. Extensions – Tools > Extensions and Updates TypeScript (Required) Web Essentials (optional) VS TS Settings – Tools > Options OR Quick Search > Typescript Text Editor > TypeScript General – Enable virtual space Project – Display Virtual Projects > Display VP when Solution is loaded | Optional Display VP when no Solution is loaded Project – Compile on Save > Use AMD Project – ECMAScript Version > Use ECMAScript 6 Web Essentials > Code Generation Add TypeScript Reference > TRUE Project Properties – TypeScript Build ALL OF IT!
  10. Variables must start with…. Using $ to start your variables can cause confusion with other JavaScript Frameworks…do not use them Reserved Words – There will be a test at the end
  11. Types Declaring Types is optional – NEVER DO IT! How to declare a type Left is TypeScript – Right is JavaScript output Available Types Primitives Arrays Enum/BitFlag Any – EXPLAIN AND DISCOURAGE!!!! Type Assertions!!!! Other Types Void Type – Used to show the absenense of value and used with a function return (come back to soon) Null Type – is a literal value…NULL Undefined Type – denotes that the variable is not available / not initialized
  12. Operations Increment/Decrement (same as C#) Math Operations (same as C#) String to Number Converter – Explain Bit Wise: << Left Shift >> Right Shift >>> Zero Fill Right Shift & AND | OR ^ XOR ~ NOT Logical Operations ! NOT !! NOT Converter – Explain (as best as possible) && AND || OR Type Operators Will cover in Classes
  13. Functions Parameters Rest is 0 or more Arrow Functions we will cover in a little bit Point of all this? TS keeps track of all the types and helps you write the code correctly. We will see this in the Demo
  14. Namespaces NS used to be called Modules and can still be called that NS can be nested Nested Namespace must be marked as Export if you plan to use them outside of parent namespace
  15. Interfaces No JS is generated from Interfaces Virtual Objects are ‘place holders’
  16. Classes Constructor verses class name Fields/Properties/Methods Access Modifiers Inheritance