SlideShare a Scribd company logo
4
Most read
16
Most read
19
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

PDF
TypeScript Introduction
PPTX
Typescript ppt
PDF
TypeScript - An Introduction
PPT
TypeScript Presentation
PPTX
Typescript in 30mins
PPTX
Why TypeScript?
PDF
TypeScript: coding JavaScript without the pain
PPTX
Getting started with typescript
TypeScript Introduction
Typescript ppt
TypeScript - An Introduction
TypeScript Presentation
Typescript in 30mins
Why TypeScript?
TypeScript: coding JavaScript without the pain
Getting started with typescript

What's hot (20)

PPTX
TypeScript Overview
PPTX
TypeScript: Basic Features and Compilation Guide
PDF
TypeScript
PDF
TypeScript Best Practices
PPTX
Introducing type script
PPT
Learning typescript
PPTX
Typescript Fundamentals
PPSX
Java annotations
PDF
Angular Dependency Injection
PDF
Building blocks of Angular
PPTX
Angular 2
ODP
Object Oriented Javascript
PPTX
Type script - advanced usage and practices
PDF
TypeScript Seminar
PPSX
C# - Part 1
PPTX
CSharp Presentation
PPT
Angular Introduction By Surekha Gadkari
PPTX
polymorphism ppt
PPTX
Design Beautiful REST + JSON APIs
PPTX
TypeScript Overview
TypeScript: Basic Features and Compilation Guide
TypeScript
TypeScript Best Practices
Introducing type script
Learning typescript
Typescript Fundamentals
Java annotations
Angular Dependency Injection
Building blocks of Angular
Angular 2
Object Oriented Javascript
Type script - advanced usage and practices
TypeScript Seminar
C# - Part 1
CSharp Presentation
Angular Introduction By Surekha Gadkari
polymorphism ppt
Design Beautiful REST + JSON APIs
Ad

Viewers also liked (15)

PPTX
TypeScript - Silver Bullet for the Full-stack Developers
PDF
TypeScript for Java Developers
PDF
Александр Русаков - TypeScript 2 in action
PDF
Typescript + Graphql = <3
PDF
Angular 2 - Typescript
PDF
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
PDF
TypeScript: Un lenguaje aburrido para programadores torpes y tristes
PPTX
TypeScript
PDF
Power Leveling your TypeScript
PPTX
Typescript tips & tricks
PPTX
002. Introducere in type script
PDF
TypeScript: Angular's Secret Weapon
PPTX
Typescript
PDF
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
PDF
TypeScriptで快適javascript
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript for Java Developers
Александр Русаков - TypeScript 2 in action
Typescript + Graphql = <3
Angular 2 - Typescript
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
TypeScript: Un lenguaje aburrido para programadores torpes y tristes
TypeScript
Power Leveling your TypeScript
Typescript tips & tricks
002. Introducere in type script
TypeScript: Angular's Secret Weapon
Typescript
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
TypeScriptで快適javascript
Ad

Similar to TypeScript (20)

PPTX
Introduction to C#.pptx for all BSIT students
PDF
Php Online Training
PPTX
TypeScript and Angular2 (Love at first sight)
PPT
Web development basics (Part-7)
PDF
Abhilash front end ppt.pdf
PPTX
saikiran front end ppt.pptx
PPTX
Introduction to JcjfjfjfkuutyuyrsdterdfbvAVA.pptx
PPTX
TypeScript 101
PPTX
06.1 .Net memory management
PPTX
OOP_Cpp_Presentation_oops_c++:; (1).pptx
PPTX
Type script
PDF
Getting Started with the TypeScript Language
PDF
Selenium-with-Java-Course-Content-Magnitia.pdf
PDF
Selenium-with-Java-Course-Content-Magnitia.pdf
PPTX
West Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
PPTX
Introduction to Python
PPTX
5variables in c#
PPTX
Introduction to python
PPTX
TypeScript . the JavaScript developer best friend!
Introduction to C#.pptx for all BSIT students
Php Online Training
TypeScript and Angular2 (Love at first sight)
Web development basics (Part-7)
Abhilash front end ppt.pdf
saikiran front end ppt.pptx
Introduction to JcjfjfjfkuutyuyrsdterdfbvAVA.pptx
TypeScript 101
06.1 .Net memory management
OOP_Cpp_Presentation_oops_c++:; (1).pptx
Type script
Getting Started with the TypeScript Language
Selenium-with-Java-Course-Content-Magnitia.pdf
Selenium-with-Java-Course-Content-Magnitia.pdf
West Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
Introduction to Python
5variables in c#
Introduction to python
TypeScript . the JavaScript developer best friend!

More from Udaiappa Ramachandran (20)

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

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Approach and Philosophy of On baking technology
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Spectroscopy.pptx food analysis technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation theory and applications.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
KodekX | Application Modernization Development
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
20250228 LYD VKU AI Blended-Learning.pptx
Empathic Computing: Creating Shared Understanding
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Approach and Philosophy of On baking technology
sap open course for s4hana steps from ECC to s4
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Weekly Chronicles - August'25 Week I
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectroscopy.pptx food analysis technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Network Security Unit 5.pdf for BCA BBA.
Encapsulation theory and applications.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KodekX | Application Modernization Development
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

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