SlideShare a Scribd company logo
1 of 17
Download to read offline
The Power of TypeScript
2
Who am I?
• Jacob Orshalick
• Principal Consultant
• solutionsfit
TypeScript Intro
• Developed and maintained by Microsoft
• Can be used on client and server (node.js)
• Any JavaScript program is valid TypeScript
• Definition files allow for use of existing JS libs
• Transpiled (source-to-source compiling)
• Angular 2 is written in TypeScript
• AtScript was absorbed into TypeScript 1.5
Why TypeScript?
• Application-scale JavaScript
• Tomorrow’s JavaScript today
• Transpiles to readable, standards-based JS
• First class types, classes, and modules
TypeScript Tutorial
• We need a compiler
• https://github.com/Microsoft/TypeScript/
• npm install -g typescript
Basic Types
let showQuote: boolean = false;
let numberOfQuotes: number = 15;
let movieName: string = "Waterboy";
let charactersArray: string[] =
[“Napoleon Dynamite", “Pedro”, “Uncle Rico”];
Tuples
let quoteTuple: [string, string] =
[“Nacho Libre", “I looked like a fool last night”];
Error:
quoteTuple = [“Nacho Libre", false];
Enums
enum MovieType {Comedy, Drama, Action};
let favoriteMovieTypes: MovieType[] =
[MovieType.Comedy, MovieType.Action];
let leastFavoriteMovieTypes: Drink[] =
[MovieType[1]];
enum MovieType {Comedy = 1, Drama = 5, Action = 6};
let favoriteMovieTypes: MovieType[] =
[MovieType[1], MovieType[6]];
Other Types
• any: useful for existing applications
• void: useful for function definitions
let favoriteQuotesOrMovieType : any =
MovieType.Comedy;
favoriteQuotesOrMovieType =
“Now that’s high quality H2O";
function askQuestion() : void {
alert(‘What is your favorite quote?');
}
let keyword
function getMessage(init: boolean) {
if (init) {
var message = "Weird";
}
return message;
}
console.log(getMessage(true)); // 1
console.log(getMessage(false)); // 2
let keyword
function getMessage(init: boolean) {
if (init) {
let message = "Weird";
}
return message;
}
console.log(getMessage(true)); // 1
console.log(getMessage(false)); // 2
Looping
• for … of statements (targets values)
• for … in statements (targets keys)
let multiCharacterQuotes: string[string,string][] =
[["Coach", "Gatorade!"], ["Bobby Boucher", "You're drinking the wrong water!”]];
for (let quote of multiCharacterQuotes) {
console.log(quote[0] + “: “ + quote[1]);
// “Coach: Gatorade!”, “Bobby Boucher: You’re drinking the wrong water!”
}
let multiCharacterQuotes: string[string,string][] =
[["Coach", "Gatorade!"], ["Bobby Boucher", "You're drinking the wrong water!”]];
for (let i in multiCharacterQuotes) {
console.log(i); // “0”, “1”
}
Arrow Functions
class Movie {
public quoteForDisplay: string;
constructor(public quotes: string[]) {}
randomizeQuote = () => {
this.quoteForDisplay =
this.quotes[
Math.floor(Math.random() * this.quotes.length)];
}
}
let movie = new Movie([“Get that corn outta my face”,
“I wanna win!”]);
setTimeout(movie.randomizeQuote,1000);
Annotations… wait, I mean
decorators
• Annotations are supported with TypeScript
• Referred to as decorators
• As with other languages, used for framework
configuration
imports and exports
• … or namespaces and module resolution
• Just the basics here:
movie.ts:
export class Movie {
// ...
}
App.ts
import {Movie} from './movie.ts';
let movie: Movie = new Movie(“Nacho Libre");
TypeScript with Ionic
• http://ionicframework.com/docs/v2/getting-started/installation/
• npm install -g ionic@beta
• ionic start [project-name] --v2 --ts
Questions?
• Jacob Orshalick
• Principal Consultant
• solutionsfit

More Related Content

What's hot

Supercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamicSupercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamicIan Robertson
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and GroovyKiyotaka Oku
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)Domenic Denicola
 
Plumbin Pipelines - A Gulp.js workshop
Plumbin Pipelines - A Gulp.js workshopPlumbin Pipelines - A Gulp.js workshop
Plumbin Pipelines - A Gulp.js workshopStefan Baumgartner
 
Embedding Groovy in a Java Application
Embedding Groovy in a Java ApplicationEmbedding Groovy in a Java Application
Embedding Groovy in a Java ApplicationPaolo Predonzani
 
ニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみようニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみようgenta kaneyama
 
Securing Docker Containers via Osquery and Kubernetes
Securing Docker Containers via Osquery and KubernetesSecuring Docker Containers via Osquery and Kubernetes
Securing Docker Containers via Osquery and KubernetesUptycs
 
Advanced JavaScript build pipelines using Gulp.js
Advanced JavaScript build pipelines using Gulp.jsAdvanced JavaScript build pipelines using Gulp.js
Advanced JavaScript build pipelines using Gulp.jsStefan Baumgartner
 
Security Challenges in Node.js
Security Challenges in Node.jsSecurity Challenges in Node.js
Security Challenges in Node.jsWebsecurify
 
JavaOne 2017 - The hitchhiker’s guide to Java class reloading
JavaOne 2017 - The hitchhiker’s guide to Java class reloadingJavaOne 2017 - The hitchhiker’s guide to Java class reloading
JavaOne 2017 - The hitchhiker’s guide to Java class reloadingAnton Arhipov
 
Solving New School with the Old School (Clojure)
Solving New School with the Old School (Clojure)Solving New School with the Old School (Clojure)
Solving New School with the Old School (Clojure)C4Media
 

What's hot (15)

Supercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamicSupercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamic
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and Groovy
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)
 
Plumbin Pipelines - A Gulp.js workshop
Plumbin Pipelines - A Gulp.js workshopPlumbin Pipelines - A Gulp.js workshop
Plumbin Pipelines - A Gulp.js workshop
 
Node ppt
Node pptNode ppt
Node ppt
 
nodecalgary1
nodecalgary1nodecalgary1
nodecalgary1
 
Embedding Groovy in a Java Application
Embedding Groovy in a Java ApplicationEmbedding Groovy in a Java Application
Embedding Groovy in a Java Application
 
Node.js
Node.jsNode.js
Node.js
 
ニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみようニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみよう
 
Securing Docker Containers via Osquery and Kubernetes
Securing Docker Containers via Osquery and KubernetesSecuring Docker Containers via Osquery and Kubernetes
Securing Docker Containers via Osquery and Kubernetes
 
Advanced JavaScript build pipelines using Gulp.js
Advanced JavaScript build pipelines using Gulp.jsAdvanced JavaScript build pipelines using Gulp.js
Advanced JavaScript build pipelines using Gulp.js
 
Node.js 0.8 features
Node.js 0.8 featuresNode.js 0.8 features
Node.js 0.8 features
 
Security Challenges in Node.js
Security Challenges in Node.jsSecurity Challenges in Node.js
Security Challenges in Node.js
 
JavaOne 2017 - The hitchhiker’s guide to Java class reloading
JavaOne 2017 - The hitchhiker’s guide to Java class reloadingJavaOne 2017 - The hitchhiker’s guide to Java class reloading
JavaOne 2017 - The hitchhiker’s guide to Java class reloading
 
Solving New School with the Old School (Clojure)
Solving New School with the Old School (Clojure)Solving New School with the Old School (Clojure)
Solving New School with the Old School (Clojure)
 

Viewers also liked

Ionic 2: Mobile apps with the Web
Ionic 2: Mobile apps with the WebIonic 2: Mobile apps with the Web
Ionic 2: Mobile apps with the WebMike Hartington
 
Introduction to Ionic framework
Introduction to Ionic frameworkIntroduction to Ionic framework
Introduction to Ionic frameworkShyjal Raazi
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Serge van den Oever
 
Ionic Mobile Applications - Hybrid Mobile Applications Without Compromises
Ionic Mobile Applications - Hybrid Mobile Applications Without CompromisesIonic Mobile Applications - Hybrid Mobile Applications Without Compromises
Ionic Mobile Applications - Hybrid Mobile Applications Without CompromisesJacob Friesen
 
TypeScript - Angular 2 - ionic 2
TypeScript - Angular 2 - ionic 2TypeScript - Angular 2 - ionic 2
TypeScript - Angular 2 - ionic 2Micael Gallego
 
Hybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic FrameworkHybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic FrameworkCihad Horuzoğlu
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideNascenia IT
 
Mobile Day - Ionic 2
Mobile Day - Ionic 2Mobile Day - Ionic 2
Mobile Day - Ionic 2Software Guru
 
Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016Evan Schultz
 
Mobile apps with Ionic 2
Mobile apps with Ionic 2Mobile apps with Ionic 2
Mobile apps with Ionic 2Khoa Nguyễn
 
Docker, your best ally to migrate & upgrading your Drupal - Drupal Dev Days S...
Docker, your best ally to migrate & upgrading your Drupal - Drupal Dev Days S...Docker, your best ally to migrate & upgrading your Drupal - Drupal Dev Days S...
Docker, your best ally to migrate & upgrading your Drupal - Drupal Dev Days S...La Drupalera
 
Beyond the web: Mobile apps using Drupal & Ionic 2 - Drupal Dev Days Seville ...
Beyond the web: Mobile apps using Drupal & Ionic 2 - Drupal Dev Days Seville ...Beyond the web: Mobile apps using Drupal & Ionic 2 - Drupal Dev Days Seville ...
Beyond the web: Mobile apps using Drupal & Ionic 2 - Drupal Dev Days Seville ...La Drupalera
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application developmentKnoldus Inc.
 

Viewers also liked (20)

Intro to ionic 2
Intro to ionic 2Intro to ionic 2
Intro to ionic 2
 
Ionic 2: Mobile apps with the Web
Ionic 2: Mobile apps with the WebIonic 2: Mobile apps with the Web
Ionic 2: Mobile apps with the Web
 
Ionic 2 - Introduction
Ionic 2 - IntroductionIonic 2 - Introduction
Ionic 2 - Introduction
 
Ionic 2 intro
Ionic 2   introIonic 2   intro
Ionic 2 intro
 
Introduction to Ionic framework
Introduction to Ionic frameworkIntroduction to Ionic framework
Introduction to Ionic framework
 
Welcome to ionic 2
Welcome to ionic 2Welcome to ionic 2
Welcome to ionic 2
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript
 
Ionic2
Ionic2Ionic2
Ionic2
 
Ionic Mobile Applications - Hybrid Mobile Applications Without Compromises
Ionic Mobile Applications - Hybrid Mobile Applications Without CompromisesIonic Mobile Applications - Hybrid Mobile Applications Without Compromises
Ionic Mobile Applications - Hybrid Mobile Applications Without Compromises
 
TypeScript - Angular 2 - ionic 2
TypeScript - Angular 2 - ionic 2TypeScript - Angular 2 - ionic 2
TypeScript - Angular 2 - ionic 2
 
Hybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic FrameworkHybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic Framework
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
 
Mobile Day - Ionic 2
Mobile Day - Ionic 2Mobile Day - Ionic 2
Mobile Day - Ionic 2
 
Gdg ionic 2
Gdg ionic 2Gdg ionic 2
Gdg ionic 2
 
Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016
 
Mobile apps with Ionic 2
Mobile apps with Ionic 2Mobile apps with Ionic 2
Mobile apps with Ionic 2
 
How to setup ionic 2
How to setup ionic 2How to setup ionic 2
How to setup ionic 2
 
Docker, your best ally to migrate & upgrading your Drupal - Drupal Dev Days S...
Docker, your best ally to migrate & upgrading your Drupal - Drupal Dev Days S...Docker, your best ally to migrate & upgrading your Drupal - Drupal Dev Days S...
Docker, your best ally to migrate & upgrading your Drupal - Drupal Dev Days S...
 
Beyond the web: Mobile apps using Drupal & Ionic 2 - Drupal Dev Days Seville ...
Beyond the web: Mobile apps using Drupal & Ionic 2 - Drupal Dev Days Seville ...Beyond the web: Mobile apps using Drupal & Ionic 2 - Drupal Dev Days Seville ...
Beyond the web: Mobile apps using Drupal & Ionic 2 - Drupal Dev Days Seville ...
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application development
 

Similar to The Power of TypeScript - Learn How to Use Types and Interfaces

Chapter i c#(console application and programming)
Chapter i c#(console application and programming)Chapter i c#(console application and programming)
Chapter i c#(console application and programming)Chhom Karath
 
Python と Docker で mypy Playground を開発した話
Python と Docker で mypy Playground を開発した話Python と Docker で mypy Playground を開発した話
Python と Docker で mypy Playground を開発した話Yusuke Miyazaki
 
201705 metaprogramming in julia
201705 metaprogramming in julia201705 metaprogramming in julia
201705 metaprogramming in julia岳華 杜
 
Real-Time Streaming with Apache Spark Streaming and Apache Storm
Real-Time Streaming with Apache Spark Streaming and Apache StormReal-Time Streaming with Apache Spark Streaming and Apache Storm
Real-Time Streaming with Apache Spark Streaming and Apache StormDavorin Vukelic
 
Testing web APIs
Testing web APIsTesting web APIs
Testing web APIsFDConf
 
Lecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLê Thưởng
 
COMP 4026 Lecture 5 OpenFrameworks and Soli
COMP 4026 Lecture 5 OpenFrameworks and SoliCOMP 4026 Lecture 5 OpenFrameworks and Soli
COMP 4026 Lecture 5 OpenFrameworks and SoliMark Billinghurst
 
JavaScript in 2015
JavaScript in 2015JavaScript in 2015
JavaScript in 2015Igor Laborie
 
Thinking Outside The [Sand]Box
Thinking Outside The [Sand]BoxThinking Outside The [Sand]Box
Thinking Outside The [Sand]BoxMichael Genkin
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureAlvaro Videla
 
Alvaro Videla, Pivotal, Inc.
Alvaro Videla, Pivotal, Inc.Alvaro Videla, Pivotal, Inc.
Alvaro Videla, Pivotal, Inc.Ontico
 
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろうUnity Technologies Japan K.K.
 

Similar to The Power of TypeScript - Learn How to Use Types and Interfaces (20)

4. Interaction
4. Interaction4. Interaction
4. Interaction
 
CDI In Real Life
CDI In Real LifeCDI In Real Life
CDI In Real Life
 
Chapter i c#(console application and programming)
Chapter i c#(console application and programming)Chapter i c#(console application and programming)
Chapter i c#(console application and programming)
 
Python と Docker で mypy Playground を開発した話
Python と Docker で mypy Playground を開発した話Python と Docker で mypy Playground を開発した話
Python と Docker で mypy Playground を開発した話
 
201705 metaprogramming in julia
201705 metaprogramming in julia201705 metaprogramming in julia
201705 metaprogramming in julia
 
Real-Time Streaming with Apache Spark Streaming and Apache Storm
Real-Time Streaming with Apache Spark Streaming and Apache StormReal-Time Streaming with Apache Spark Streaming and Apache Storm
Real-Time Streaming with Apache Spark Streaming and Apache Storm
 
Testing web APIs
Testing web APIsTesting web APIs
Testing web APIs
 
Gcrc talk
Gcrc talkGcrc talk
Gcrc talk
 
Lecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdf
 
COMP 4026 Lecture 5 OpenFrameworks and Soli
COMP 4026 Lecture 5 OpenFrameworks and SoliCOMP 4026 Lecture 5 OpenFrameworks and Soli
COMP 4026 Lecture 5 OpenFrameworks and Soli
 
JavaScript in 2015
JavaScript in 2015JavaScript in 2015
JavaScript in 2015
 
Ruby Under The Hood
Ruby Under The HoodRuby Under The Hood
Ruby Under The Hood
 
Thinking Outside The [Sand]Box
Thinking Outside The [Sand]BoxThinking Outside The [Sand]Box
Thinking Outside The [Sand]Box
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal Architecture
 
Alvaro Videla, Pivotal, Inc.
Alvaro Videla, Pivotal, Inc.Alvaro Videla, Pivotal, Inc.
Alvaro Videla, Pivotal, Inc.
 
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
 
Angular2
Angular2Angular2
Angular2
 
Buffer overflow Attacks
Buffer overflow AttacksBuffer overflow Attacks
Buffer overflow Attacks
 
Buffer Overflow Attacks
Buffer Overflow AttacksBuffer Overflow Attacks
Buffer Overflow Attacks
 
World of Logging
World of LoggingWorld of Logging
World of Logging
 

Recently uploaded

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 

Recently uploaded (20)

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 

The Power of TypeScript - Learn How to Use Types and Interfaces

  • 1. The Power of TypeScript 2
  • 2. Who am I? • Jacob Orshalick • Principal Consultant • solutionsfit
  • 3. TypeScript Intro • Developed and maintained by Microsoft • Can be used on client and server (node.js) • Any JavaScript program is valid TypeScript • Definition files allow for use of existing JS libs • Transpiled (source-to-source compiling) • Angular 2 is written in TypeScript • AtScript was absorbed into TypeScript 1.5
  • 4. Why TypeScript? • Application-scale JavaScript • Tomorrow’s JavaScript today • Transpiles to readable, standards-based JS • First class types, classes, and modules
  • 5. TypeScript Tutorial • We need a compiler • https://github.com/Microsoft/TypeScript/ • npm install -g typescript
  • 6. Basic Types let showQuote: boolean = false; let numberOfQuotes: number = 15; let movieName: string = "Waterboy"; let charactersArray: string[] = [“Napoleon Dynamite", “Pedro”, “Uncle Rico”];
  • 7. Tuples let quoteTuple: [string, string] = [“Nacho Libre", “I looked like a fool last night”]; Error: quoteTuple = [“Nacho Libre", false];
  • 8. Enums enum MovieType {Comedy, Drama, Action}; let favoriteMovieTypes: MovieType[] = [MovieType.Comedy, MovieType.Action]; let leastFavoriteMovieTypes: Drink[] = [MovieType[1]]; enum MovieType {Comedy = 1, Drama = 5, Action = 6}; let favoriteMovieTypes: MovieType[] = [MovieType[1], MovieType[6]];
  • 9. Other Types • any: useful for existing applications • void: useful for function definitions let favoriteQuotesOrMovieType : any = MovieType.Comedy; favoriteQuotesOrMovieType = “Now that’s high quality H2O"; function askQuestion() : void { alert(‘What is your favorite quote?'); }
  • 10. let keyword function getMessage(init: boolean) { if (init) { var message = "Weird"; } return message; } console.log(getMessage(true)); // 1 console.log(getMessage(false)); // 2
  • 11. let keyword function getMessage(init: boolean) { if (init) { let message = "Weird"; } return message; } console.log(getMessage(true)); // 1 console.log(getMessage(false)); // 2
  • 12. Looping • for … of statements (targets values) • for … in statements (targets keys) let multiCharacterQuotes: string[string,string][] = [["Coach", "Gatorade!"], ["Bobby Boucher", "You're drinking the wrong water!”]]; for (let quote of multiCharacterQuotes) { console.log(quote[0] + “: “ + quote[1]); // “Coach: Gatorade!”, “Bobby Boucher: You’re drinking the wrong water!” } let multiCharacterQuotes: string[string,string][] = [["Coach", "Gatorade!"], ["Bobby Boucher", "You're drinking the wrong water!”]]; for (let i in multiCharacterQuotes) { console.log(i); // “0”, “1” }
  • 13. Arrow Functions class Movie { public quoteForDisplay: string; constructor(public quotes: string[]) {} randomizeQuote = () => { this.quoteForDisplay = this.quotes[ Math.floor(Math.random() * this.quotes.length)]; } } let movie = new Movie([“Get that corn outta my face”, “I wanna win!”]); setTimeout(movie.randomizeQuote,1000);
  • 14. Annotations… wait, I mean decorators • Annotations are supported with TypeScript • Referred to as decorators • As with other languages, used for framework configuration
  • 15. imports and exports • … or namespaces and module resolution • Just the basics here: movie.ts: export class Movie { // ... } App.ts import {Movie} from './movie.ts'; let movie: Movie = new Movie(“Nacho Libre");
  • 16. TypeScript with Ionic • http://ionicframework.com/docs/v2/getting-started/installation/ • npm install -g ionic@beta • ionic start [project-name] --v2 --ts
  • 17. Questions? • Jacob Orshalick • Principal Consultant • solutionsfit