SlideShare a Scribd company logo
7
Most read
16
Most read
18
Most read
TypeScript
Udaiappa Ramachandran ( Udai )
//linkedin.com/in/udair
Who am I?
• Udaiappa Ramachandran ( Udai )
• CTO, Akumina, Inc.,
• Consultant
• Azure Insider
• New Hampshire Cloud User Group (http://www.meetup.com/nashuaug )
• Focus on Cloud Computing (Microsoft Azure and AWS), IoT, SharePoint
Online
• http://cloudycode.wordpress.com
• @nhcloud
TypeScript - Agenda
• Why & What
• Basic Types
• Interfaces
• Functions
• Classes
• Generics
• Modules
• Demo
• References
• Q & A
Typescript
• Why
• Javascript is dynamic type
• Pro– can hold any object, type on the fly
• Con- Can get messy over the time
• Migration from server-side to client-side will be hard
• Hard to manage, difficult to ensure property types
• What
• Any valid JavaScript is a typescript
• Typescriptlang.org
• Typescript lets you write JavaScript the way you really want to.
• Typescript is a typed superset of JavaScript that compiles to plain JavaScript.
• Any browser. Any host. Any OS. Open Source.
Typescript Alternatives
• Pure JavaScript
• Apply JavaScript patterns
• Functions as abstractions
• Functions to build modules
• Functions to avoid global variables
• CoffeeScript
• Dart
Typescript Key Features
• Supports standard JavaScript code
• Provide static typing
• Encapsulation through classes and modules
• Support for constructors, properties, functions
• Define interfaces
• Lambda style function support
• Intellisense and syntax checking
Typescript tools
• Typescript playground
• Visual Studio
• sublime
• Node.js
• WebStorm
• Eclipse
• Vi
• IntelliJ
• Emacs
Typescript to JavaScript
Tyepscript BasicTypes
• Boolean
• Number
• String
• Array
• Enum
• Enum as Bit Flag 1,2,4,8,16,32,64,128 and so on
• Any
• Void
Tyepscript Annotation
• Type Annotation
• var [identifier]:[type annotation]=value
• var [identifier]:[type annotation];
• var [identifier]=value;
• Example
Typescript Functions
• Optional Parameters using ?
• function getAverage(a: number, b: number, c?: number): void { }
• Default parameters using =value
• function concatenate(items: string[], separator = ",", beginAt = 0, endAt = items.length) :void{ }
• Rest parameter using …
• Only one allowed, it must appear last in the parameter list and must be an array type
• function getSum(...a: number[]): number {
• var t = 0;a.forEach(p=>t=t+ p);
• return t;
• }
• var result = getSum(1, 2, 3, 4);
• Overloads
• Overloads in typescript cannot have own implementation but decorate a single implementation
• function getSum(a: string, b: string, c: string): number;
• function getSum(a: number, b: number, c: number): number;
• function getSum(a: any, b: any, c: any): number {
• // implementation signature
• return parseInt(a, 10) + parseInt(b, 10) + parseInt(c, 10);
• }
• Arrow function
• var getSum: (a: number, b: number) => number =(x, y) => (x + y);
Typescript Interfaces
• Interfaces are used at design time to provide auto completion and at compile time
to provide type checking
• Supported features
• Optional properties
• Function Types
• Array Types
• Class Types
• Extending Interfaces
• Hybrid Types
Typescript Interfaces
Typescript Classes
• Object-oriented class based approach
• Key features
• Inheritance
• Private/public modifiers
• Accessors
• Static properties
• Constructor functions
• Using class as an interface
Typescript Classes
Typescript Generics
• Supports generic type variables, types, interfaces, classes and constraints
Typescript Modules
• Encapsulate variables, interfaces, and classes
• Define unique namespaces
• Organize symbols and identifiers into a logical namespace hierarchy
• Similar to namespaces/packages
• Splitting across files
• Multiple files can use the same module name
• One file can contain multiple module
• Can define Alias to module
• Transpiles to IIFE
• Can define modules as internal or external
• External modules required only when used with node.js and require.js
Typescript Modules
Typescript Declaration Merging
• Concept
• Merging Interfaces
• Merging Modules
• Merging Modules with classes, functions, and Enums
• Disallowed Merges
Typescript Type inference and Compatibility
• Type inference
• Basics
• Best common type
• Contextual Type
• Type Compatibility
• Starting out
• Comparing two functions
• Enums
• Classes
• Generics
• Advanced Topics
• Common Errors
• Mixins
Typescript Definition Files
• Describes the types defined in external libraries
• .d.ts
• Not deployed
• Usually from DefinitelyTyped
• TypeScript Definition manager (tsd)
• Specialized package manager
• Locates and installs typescript definition files(d.ts)
• From the definitelytyped repository
Demo
Reference
• //typescriptlang.org
Q & A

More Related Content

What's hot (20)

PPTX
Typescript: Beginner to Advanced
Talentica Software
 
PPTX
Why TypeScript?
FITC
 
PPT
Introduction to JavaScript
Andres Baravalle
 
PPTX
TypeScript intro
Ats Uiboupin
 
PPTX
Introducing type script
Remo Jansen
 
PPTX
Typescript in 30mins
Udaya Kumar
 
PPT
TypeScript Presentation
Patrick John Pacaña
 
PPT
Introduction to Javascript
Amit Tyagi
 
PPTX
Javascript 101
Shlomi Komemi
 
PDF
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
Edureka!
 
PPTX
Type script - advanced usage and practices
Iwan van der Kleijn
 
PDF
Angular - Chapter 1 - Introduction
WebStackAcademy
 
PPTX
Spring Boot and REST API
07.pallav
 
PPT
Javascript
guest03a6e6
 
PDF
Lets make a better react form
Yao Nien Chung
 
PDF
ES6 presentation
ritika1
 
PDF
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
Edureka!
 
PDF
TypeScript Best Practices
felixbillon
 
PDF
Angular Observables & RxJS Introduction
Rahat Khanna a.k.a mAppMechanic
 
PDF
TypeScript
Saray Chak
 
Typescript: Beginner to Advanced
Talentica Software
 
Why TypeScript?
FITC
 
Introduction to JavaScript
Andres Baravalle
 
TypeScript intro
Ats Uiboupin
 
Introducing type script
Remo Jansen
 
Typescript in 30mins
Udaya Kumar
 
TypeScript Presentation
Patrick John Pacaña
 
Introduction to Javascript
Amit Tyagi
 
Javascript 101
Shlomi Komemi
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
Edureka!
 
Type script - advanced usage and practices
Iwan van der Kleijn
 
Angular - Chapter 1 - Introduction
WebStackAcademy
 
Spring Boot and REST API
07.pallav
 
Javascript
guest03a6e6
 
Lets make a better react form
Yao Nien Chung
 
ES6 presentation
ritika1
 
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
Edureka!
 
TypeScript Best Practices
felixbillon
 
Angular Observables & RxJS Introduction
Rahat Khanna a.k.a mAppMechanic
 
TypeScript
Saray Chak
 

Viewers also liked (16)

PPTX
TypeScript - Silver Bullet for the Full-stack Developers
Rutenis Turcinas
 
PDF
TypeScript for Java Developers
Yakov Fain
 
PDF
Александр Русаков - TypeScript 2 in action
MoscowJS
 
PDF
Typescript + Graphql = <3
felixbillon
 
PDF
Angular 2 - Typescript
Nathan Krasney
 
PDF
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
Ontico
 
PDF
TypeScript Seminar
Haim Michael
 
PDF
TypeScript: Un lenguaje aburrido para programadores torpes y tristes
Micael Gallego
 
PPTX
TypeScript
GetDev.NET
 
PDF
Power Leveling your TypeScript
Offirmo
 
PPTX
Typescript tips & tricks
Ori Calvo
 
PPTX
002. Introducere in type script
Dmitrii Stoian
 
PDF
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
PPTX
Typescript
Nikhil Thomas
 
PDF
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
MoscowJS
 
PDF
TypeScriptで快適javascript
AfiruPain NaokiSoga
 
TypeScript - Silver Bullet for the Full-stack Developers
Rutenis Turcinas
 
TypeScript for Java Developers
Yakov Fain
 
Александр Русаков - TypeScript 2 in action
MoscowJS
 
Typescript + Graphql = <3
felixbillon
 
Angular 2 - Typescript
Nathan Krasney
 
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
Ontico
 
TypeScript Seminar
Haim Michael
 
TypeScript: Un lenguaje aburrido para programadores torpes y tristes
Micael Gallego
 
TypeScript
GetDev.NET
 
Power Leveling your TypeScript
Offirmo
 
Typescript tips & tricks
Ori Calvo
 
002. Introducere in type script
Dmitrii Stoian
 
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
Typescript
Nikhil Thomas
 
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
MoscowJS
 
TypeScriptで快適javascript
AfiruPain NaokiSoga
 
Ad

Similar to TypeScript (20)

PDF
Introduction to TypeScript
NexThoughts Technologies
 
PPTX
typescript.pptx
ZeynepOtu
 
PPTX
Complete Notes on Angular 2 and TypeScript
EPAM Systems
 
PDF
TypeScript introduction to scalable javascript application
Andrea Paciolla
 
PDF
TypeScript Interview Questions PDF By ScholarHat
Scholarhat
 
PPTX
Why do we need TypeScript?
Nitay Neeman
 
PPTX
TypeScript: Basic Features and Compilation Guide
Nascenia IT
 
PDF
TYPESCRIPT.pdfgshshhsjajajsjsjjsjajajjajjj
sonidsxyz02
 
PPTX
Type script
Zunair Shoes
 
PDF
Reasons to Use Typescript for Your Next Project Over Javascript.pdf
MobMaxime
 
PDF
TypeScipt - Get Started
Krishnanand Sivaraj
 
PPTX
Type script
Mallikarjuna G D
 
PPT
Learning typescript
Alexandre Marreiros
 
PPTX
TypeScript Introduction
Travis van der Font
 
PPTX
Rits Brown Bag - TypeScript
Right IT Services
 
PPTX
TypeScript 101
rachelterman
 
PPTX
Typescript language extension of java script
michaelaaron25322
 
DOC
Typescript Basics
Manikandan [M M K]
 
PPTX
TypeScript Introduction
Thanh Tai
 
PDF
Type script
srinivaskapa1
 
Introduction to TypeScript
NexThoughts Technologies
 
typescript.pptx
ZeynepOtu
 
Complete Notes on Angular 2 and TypeScript
EPAM Systems
 
TypeScript introduction to scalable javascript application
Andrea Paciolla
 
TypeScript Interview Questions PDF By ScholarHat
Scholarhat
 
Why do we need TypeScript?
Nitay Neeman
 
TypeScript: Basic Features and Compilation Guide
Nascenia IT
 
TYPESCRIPT.pdfgshshhsjajajsjsjjsjajajjajjj
sonidsxyz02
 
Type script
Zunair Shoes
 
Reasons to Use Typescript for Your Next Project Over Javascript.pdf
MobMaxime
 
TypeScipt - Get Started
Krishnanand Sivaraj
 
Type script
Mallikarjuna G D
 
Learning typescript
Alexandre Marreiros
 
TypeScript Introduction
Travis van der Font
 
Rits Brown Bag - TypeScript
Right IT Services
 
TypeScript 101
rachelterman
 
Typescript language extension of java script
michaelaaron25322
 
Typescript Basics
Manikandan [M M K]
 
TypeScript Introduction
Thanh Tai
 
Type script
srinivaskapa1
 
Ad

More from Udaiappa Ramachandran (20)

PPTX
Transform Any Website into a Conversational Experience with NLWeb
Udaiappa Ramachandran
 
PPTX
Scalable Multi-Agent AI with AutoGen by Udai
Udaiappa Ramachandran
 
PPTX
Building .NET AI Applications with Google AI: Leveraging Vertex AI and Gemini
Udaiappa Ramachandran
 
PPTX
Microsoft Fabric by Udaiappa Ramachandran.pptx
Udaiappa Ramachandran
 
PPTX
.NET Aspire Presentation by Udaiappa Ramachandran
Udaiappa Ramachandran
 
PPTX
AI-Driven Dynamic Data Querying and Visualization with KQL and SQL
Udaiappa Ramachandran
 
PPTX
Advanced Application Protection with Azure WAF
Udaiappa Ramachandran
 
PPTX
RAG Patterns and Vector Search in Generative AI
Udaiappa Ramachandran
 
PPTX
Level up your security using Intune.pptx
Udaiappa Ramachandran
 
PPTX
Building AI-Driven Apps Using Semantic Kernel.pptx
Udaiappa Ramachandran
 
PPTX
AI-Plugins-Planners-Persona-SemanticKernel.pptx
Udaiappa Ramachandran
 
PPTX
DOTNET8.pptx
Udaiappa Ramachandran
 
PPTX
AzureSynapse.pptx
Udaiappa Ramachandran
 
PPTX
Vector Search using OpenAI in Azure Cognitive Search.pptx
Udaiappa Ramachandran
 
PPTX
SecureAzureServicesUsingADAuthentication.pptx
Udaiappa Ramachandran
 
PPTX
AzureOpenAI.pptx
Udaiappa Ramachandran
 
PPTX
OpenAI-Copilot-ChatGPT.pptx
Udaiappa Ramachandran
 
PPTX
DiagnoseAndSolveproblems.pptx
Udaiappa Ramachandran
 
PPTX
MAUI.pptx
Udaiappa Ramachandran
 
PPTX
CosmosDB.pptx
Udaiappa Ramachandran
 
Transform Any Website into a Conversational Experience with NLWeb
Udaiappa Ramachandran
 
Scalable Multi-Agent AI with AutoGen by Udai
Udaiappa Ramachandran
 
Building .NET AI Applications with Google AI: Leveraging Vertex AI and Gemini
Udaiappa Ramachandran
 
Microsoft Fabric by Udaiappa Ramachandran.pptx
Udaiappa Ramachandran
 
.NET Aspire Presentation by Udaiappa Ramachandran
Udaiappa Ramachandran
 
AI-Driven Dynamic Data Querying and Visualization with KQL and SQL
Udaiappa Ramachandran
 
Advanced Application Protection with Azure WAF
Udaiappa Ramachandran
 
RAG Patterns and Vector Search in Generative AI
Udaiappa Ramachandran
 
Level up your security using Intune.pptx
Udaiappa Ramachandran
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Udaiappa Ramachandran
 
AI-Plugins-Planners-Persona-SemanticKernel.pptx
Udaiappa Ramachandran
 
DOTNET8.pptx
Udaiappa Ramachandran
 
AzureSynapse.pptx
Udaiappa Ramachandran
 
Vector Search using OpenAI in Azure Cognitive Search.pptx
Udaiappa Ramachandran
 
SecureAzureServicesUsingADAuthentication.pptx
Udaiappa Ramachandran
 
AzureOpenAI.pptx
Udaiappa Ramachandran
 
OpenAI-Copilot-ChatGPT.pptx
Udaiappa Ramachandran
 
DiagnoseAndSolveproblems.pptx
Udaiappa Ramachandran
 
CosmosDB.pptx
Udaiappa Ramachandran
 

Recently uploaded (20)

PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 

TypeScript

  • 1. TypeScript Udaiappa Ramachandran ( Udai ) //linkedin.com/in/udair
  • 2. Who am I? • Udaiappa Ramachandran ( Udai ) • CTO, Akumina, Inc., • Consultant • Azure Insider • New Hampshire Cloud User Group (http://www.meetup.com/nashuaug ) • Focus on Cloud Computing (Microsoft Azure and AWS), IoT, SharePoint Online • http://cloudycode.wordpress.com • @nhcloud
  • 3. TypeScript - Agenda • Why & What • Basic Types • Interfaces • Functions • Classes • Generics • Modules • Demo • References • Q & A
  • 4. Typescript • Why • Javascript is dynamic type • Pro– can hold any object, type on the fly • Con- Can get messy over the time • Migration from server-side to client-side will be hard • Hard to manage, difficult to ensure property types • What • Any valid JavaScript is a typescript • Typescriptlang.org • Typescript lets you write JavaScript the way you really want to. • Typescript is a typed superset of JavaScript that compiles to plain JavaScript. • Any browser. Any host. Any OS. Open Source.
  • 5. Typescript Alternatives • Pure JavaScript • Apply JavaScript patterns • Functions as abstractions • Functions to build modules • Functions to avoid global variables • CoffeeScript • Dart
  • 6. Typescript Key Features • Supports standard JavaScript code • Provide static typing • Encapsulation through classes and modules • Support for constructors, properties, functions • Define interfaces • Lambda style function support • Intellisense and syntax checking
  • 7. Typescript tools • Typescript playground • Visual Studio • sublime • Node.js • WebStorm • Eclipse • Vi • IntelliJ • Emacs
  • 9. Tyepscript BasicTypes • Boolean • Number • String • Array • Enum • Enum as Bit Flag 1,2,4,8,16,32,64,128 and so on • Any • Void
  • 10. Tyepscript Annotation • Type Annotation • var [identifier]:[type annotation]=value • var [identifier]:[type annotation]; • var [identifier]=value; • Example
  • 11. Typescript Functions • Optional Parameters using ? • function getAverage(a: number, b: number, c?: number): void { } • Default parameters using =value • function concatenate(items: string[], separator = ",", beginAt = 0, endAt = items.length) :void{ } • Rest parameter using … • Only one allowed, it must appear last in the parameter list and must be an array type • function getSum(...a: number[]): number { • var t = 0;a.forEach(p=>t=t+ p); • return t; • } • var result = getSum(1, 2, 3, 4); • Overloads • Overloads in typescript cannot have own implementation but decorate a single implementation • function getSum(a: string, b: string, c: string): number; • function getSum(a: number, b: number, c: number): number; • function getSum(a: any, b: any, c: any): number { • // implementation signature • return parseInt(a, 10) + parseInt(b, 10) + parseInt(c, 10); • } • Arrow function • var getSum: (a: number, b: number) => number =(x, y) => (x + y);
  • 12. Typescript Interfaces • Interfaces are used at design time to provide auto completion and at compile time to provide type checking • Supported features • Optional properties • Function Types • Array Types • Class Types • Extending Interfaces • Hybrid Types
  • 14. Typescript Classes • Object-oriented class based approach • Key features • Inheritance • Private/public modifiers • Accessors • Static properties • Constructor functions • Using class as an interface
  • 16. Typescript Generics • Supports generic type variables, types, interfaces, classes and constraints
  • 17. Typescript Modules • Encapsulate variables, interfaces, and classes • Define unique namespaces • Organize symbols and identifiers into a logical namespace hierarchy • Similar to namespaces/packages • Splitting across files • Multiple files can use the same module name • One file can contain multiple module • Can define Alias to module • Transpiles to IIFE • Can define modules as internal or external • External modules required only when used with node.js and require.js
  • 19. Typescript Declaration Merging • Concept • Merging Interfaces • Merging Modules • Merging Modules with classes, functions, and Enums • Disallowed Merges
  • 20. Typescript Type inference and Compatibility • Type inference • Basics • Best common type • Contextual Type • Type Compatibility • Starting out • Comparing two functions • Enums • Classes • Generics • Advanced Topics • Common Errors • Mixins
  • 21. Typescript Definition Files • Describes the types defined in external libraries • .d.ts • Not deployed • Usually from DefinitelyTyped • TypeScript Definition manager (tsd) • Specialized package manager • Locates and installs typescript definition files(d.ts) • From the definitelytyped repository
  • 22. Demo
  • 24. Q & A

Editor's Notes

  • #5: Typescript will still try to create sensible JS code even if compilation error, but it is important to fix the compilation error
  • #20: Module merging Class Car{ } Module Car { Export Engine{} Export XYZ{} }
  • #22: IIFE-Immediately Invoked Function Expressions