SlideShare a Scribd company logo
1 of 24
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

What's hot (20)

TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
 
TypeScript
TypeScriptTypeScript
TypeScript
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
 
Typescript: Beginner to Advanced
Typescript: Beginner to AdvancedTypescript: Beginner to Advanced
Typescript: Beginner to Advanced
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
Typescript overview
Typescript overviewTypescript overview
Typescript overview
 
Angular 4 and TypeScript
Angular 4 and TypeScriptAngular 4 and TypeScript
Angular 4 and TypeScript
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Angular Observables & RxJS Introduction
Angular Observables & RxJS IntroductionAngular Observables & RxJS Introduction
Angular Observables & RxJS Introduction
 
TypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptxTypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptx
 
LINQ in C#
LINQ in C#LINQ in C#
LINQ in C#
 
TypeScript and Angular workshop
TypeScript and Angular workshopTypeScript and Angular workshop
TypeScript and Angular workshop
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
 

Viewers also liked

Viewers also liked (16)

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

Similar to TypeScript

Similar to TypeScript (20)

Php Online Training
Php Online TrainingPhp Online Training
Php Online Training
 
TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)
 
Web development basics (Part-7)
Web development basics (Part-7)Web development basics (Part-7)
Web development basics (Part-7)
 
Abhilash front end ppt.pdf
Abhilash front end ppt.pdfAbhilash front end ppt.pdf
Abhilash front end ppt.pdf
 
saikiran front end ppt.pptx
saikiran front end ppt.pptxsaikiran front end ppt.pptx
saikiran front end ppt.pptx
 
TypeScript 101
TypeScript 101TypeScript 101
TypeScript 101
 
06.1 .Net memory management
06.1 .Net memory management06.1 .Net memory management
06.1 .Net memory management
 
Type script
Type scriptType script
Type script
 
Getting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGetting Started with the TypeScript Language
Getting Started with the TypeScript Language
 
Selenium-with-Java-Course-Content-Magnitia.pdf
Selenium-with-Java-Course-Content-Magnitia.pdfSelenium-with-Java-Course-Content-Magnitia.pdf
Selenium-with-Java-Course-Content-Magnitia.pdf
 
Selenium-with-Java-Course-Content-Magnitia.pdf
Selenium-with-Java-Course-Content-Magnitia.pdfSelenium-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
West Coast DevCon 2014: Programming in UE4 - A Quick Orientation for CodersWest Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
West Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
5variables in c#
5variables in c#5variables in c#
5variables in c#
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
c++ Unit III - PPT.pptx
c++ Unit III - PPT.pptxc++ Unit III - PPT.pptx
c++ Unit III - PPT.pptx
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
 
David buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharpDavid buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharp
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 

More from Udaiappa Ramachandran

More from Udaiappa Ramachandran (20)

RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AI
 
Level up your security using Intune.pptx
Level up your security using Intune.pptxLevel up your security using Intune.pptx
Level up your security using Intune.pptx
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
AI-Plugins-Planners-Persona-SemanticKernel.pptx
AI-Plugins-Planners-Persona-SemanticKernel.pptxAI-Plugins-Planners-Persona-SemanticKernel.pptx
AI-Plugins-Planners-Persona-SemanticKernel.pptx
 
DOTNET8.pptx
DOTNET8.pptxDOTNET8.pptx
DOTNET8.pptx
 
AzureSynapse.pptx
AzureSynapse.pptxAzureSynapse.pptx
AzureSynapse.pptx
 
Vector Search using OpenAI in Azure Cognitive Search.pptx
Vector Search using OpenAI in Azure Cognitive Search.pptxVector Search using OpenAI in Azure Cognitive Search.pptx
Vector Search using OpenAI in Azure Cognitive Search.pptx
 
SecureAzureServicesUsingADAuthentication.pptx
SecureAzureServicesUsingADAuthentication.pptxSecureAzureServicesUsingADAuthentication.pptx
SecureAzureServicesUsingADAuthentication.pptx
 
AzureOpenAI.pptx
AzureOpenAI.pptxAzureOpenAI.pptx
AzureOpenAI.pptx
 
OpenAI-Copilot-ChatGPT.pptx
OpenAI-Copilot-ChatGPT.pptxOpenAI-Copilot-ChatGPT.pptx
OpenAI-Copilot-ChatGPT.pptx
 
DiagnoseAndSolveproblems.pptx
DiagnoseAndSolveproblems.pptxDiagnoseAndSolveproblems.pptx
DiagnoseAndSolveproblems.pptx
 
MAUI.pptx
MAUI.pptxMAUI.pptx
MAUI.pptx
 
CosmosDB.pptx
CosmosDB.pptxCosmosDB.pptx
CosmosDB.pptx
 
.NET7.pptx
.NET7.pptx.NET7.pptx
.NET7.pptx
 
AzureDevOps
AzureDevOpsAzureDevOps
AzureDevOps
 
AzureCostManagementAndBilling
AzureCostManagementAndBillingAzureCostManagementAndBilling
AzureCostManagementAndBilling
 
.NET6.pptx
.NET6.pptx.NET6.pptx
.NET6.pptx
 
Azure Automation and Update Management
Azure Automation and Update ManagementAzure Automation and Update Management
Azure Automation and Update Management
 
Azure staticwebapps
Azure staticwebappsAzure staticwebapps
Azure staticwebapps
 
Azure privatelink
Azure privatelinkAzure privatelink
Azure privatelink
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

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

  1. Typescript will still try to create sensible JS code even if compilation error, but it is important to fix the compilation error
  2. Module merging Class Car{ } Module Car { Export Engine{} Export XYZ{} }
  3. IIFE-Immediately Invoked Function Expressions