SlideShare a Scribd company logo
TypeScript
Hello!
I am Hiten Pratap Singh
I am here because I love to dive into new
interesting things.
You can find me at:
https://github.com/hitenpratap/
https://hprog99.wordpress.com/
hiten@nexthoughts.com
Agenda
▷ Introduction
▷ Installation
▷ Why TypeScript?
▷ Features
▷ Comparison With TypeScript Alternatives
▷ Who Uses TypeScript?
▷ Conclusion
1.
Introduction
JavaScript that scales.
“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.
Overview
▷ Syntax based on ECMAScript 4 &
ECMASCript 6 proposals
▷ TS is first and foremost a superset of JS
▷ Any regular Javascript is valid TypeScript
Code
“Microsoft's TypeScript may be the best of the
many JavaScript front ends. It seems to
generate the most attractive code.”
- Douglas Crockford
"CoffeeScript is to Ruby as TypeScript is to
Java/C#/C++."
- Luke Hoban
2.
Installation
How to get it setup?
How To Install
For more details check: https://www.typescriptlang.org/docs/tutorial.html
Via npm (the Node.js package manager)
By installing TypeScript’s Visual Studio plugins
Just download any appropriate Visual Studio from Microsoft site and you are all set to go.
You can also try Visual Studio Code IDE from https://code.visualstudio.com/ which is free, open
source and available for multi-platform.
3.
Why TypeScript?
Why everyone is using it more and more.
Main Goals of TypeScript
▷ Provide an optional type system for
JavaScript.
▷ Provide planned features from future
JavaScript editions to current JavaScript
engines
▷ Modular Development
4.
Features
What makes TypeScript super awesome
TypeScript Features
▷ Data Types Supported
▷ Optional Static Type Annotation
▷ Classes
▷ Interface
▷ Modules
▷ Arrow Expressions
▷ Type Assertions
▷ Ambient Declarations
▷ Source File Dependencies
Data Types
▷ Any
▷ Primitive
- Number
- Boolean
- String
- Void
- Null
- Undefined - Same as JS
▷ Array
▷ Enum
Any is used when it’s impossible to determine the type
Any
▷ Doesn’t have separate integers and float/double type. These all are
floating point values and get the type ‘number’
▷ boolean - true/false value
▷ string - both single/double quote can be used
▷ No separate char type
▷ void - is used in function type returning nothing
▷ null and undefined - functions as usual
Primitive
Array
By default, enums begin numbering their members starting at 0. You can
change this by manually setting the value of one its members.
Enum
Optional Types
Type Annotations/Checking
JavaScript
TypeScript
Type Inference
▷ TypeScript tries to infer types
▷ Four ways to variable declaration -
- Type and Value in one statement
- Type but no Value then Value will be undefined
- Value but on Type then the it will be of Any type but maybe be
inferred based on its value.
- Neither Value nor Type then Type will be Any and Value will
be undefined.
Classes
▷ Can implement interfaces
▷ Inheritance
▷ Instance methods/members
▷ Static methods/members
▷ Single constructor
▷ Default/Optional parameter
▷ ES6 class syntax
TypeScript Classes
TypeScript Classes Example
Inheritances
▷ Declared using interface keyword
▷ Like other TS features it’s design time features i.e. no extra code
would be emitted to resultant JS file
▷ Errors being shown when interface signature and implementation
doesn’t match.
TypeScript Interfaces
TypeScript Interfaces
Example
Modules
▷ Modules can be defined using module keyword
▷ A module can contains sub-modules, class, enums or interfaces. But
can’t directly contains functions.
▷ Modules can be nested(sub-modules).
▷ Classes and Interfaces can be exposed using export keyword.
TypeScript Modules
TypeScript Modules Example
Arrow Expressions
▷ Implicit return
▷ No braces for single expression
▷ Part of ES6
▷ Lexically scoped this
▷ You don't need to keep typing function
▷ It lexically captures the meaning of arguments
Arrow Expressions
Arrow Expressions Example
Type Assertions
TypeScript's type assertion are purely you telling the
compiler that you know about the types better than it
does, and that it should not second guess you.
Type Assertions
Type Assertions Example
Ambient Declarations
A major design goal of TypeScript was to make it
possible for you to safely and easily use existing
JavaScript libraries in TypeScript. TypeScript does this
by means of declaration.
Ambient Declarations
Source File Dependencies
▷ Can be done using reference keyword
▷ Must be the first statement of file
▷ Paths are relative to the current file
▷ Can also be done using tsconfig file
Source File Dependencies
Source File Dependencies Example
5.
Comparison with TS
Alternative
▷ Complete language + Runtime overhaul
▷ More features: generators, comprehensions, object literals etc
▷ Will take years before widely deployed
▷ No typing as of now(Maybe ES7)
TypeScript VS ES6 Harmony
▷ Also a superset to JavaScript
▷ More syntactic sugar, still dynamically typed
▷ Unlike TypeScript, JS is not valid CoffeeScript code
▷ It doesn’t track ECMAScript 6
TypeScript VS CoffeeScript
▷ Optionally typed
▷ A native VM
▷ Operator overloading
▷ ECMAScript Dart spec
▷ Completely different syntax and semantics than JS
TypeScript VS DART
6.
Who Uses TypeScript?
Companies use TypeScript
7.
Conclusion
Pros:
▷ High value, low cost improvement over JavaScript
▷ Safer and more modular
▷ Solid path to ECMAScript 6
Cons:
▷ Still need to know some JS quirks
▷ Current compiler slowish(Faster one is in development)
Conclusion
Thanks!
Any questions?
You can find me at:
https://github.com/hitenpratap/
https://hprog99.wordpress.com/
hiten@nexthoughts.com
References
▷ https://www.typescriptlang.org/docs/tutorial.html
▷ https://learnxinyminutes.com/docs/typescript/
▷ https://basarat.gitbooks.io/typescript/content/
▷ http://www.slideshare.net/SanderMak/typescript-coding-javascript-
without-the-pain
▷ http://www.slideshare.net/aniruddha.chakrabarti/typescript-44668095

More Related Content

What's hot

TypeScript intro
TypeScript introTypeScript intro
TypeScript intro
Ats Uiboupin
 
Why TypeScript?
Why TypeScript?Why TypeScript?
Why TypeScript?
FITC
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
felixbillon
 
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
Malla Reddy University
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
C...L, NESPRESSO, WAFAASSURANCE, SOFRECOM ORANGE
 
TypeScript
TypeScriptTypeScript
TypeScript
Saray Chak
 
Basics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdfBasics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdf
Knoldus Inc.
 
Typescript in React: HOW & WHY?
Typescript in React: HOW & WHY?Typescript in React: HOW & WHY?
Typescript in React: HOW & WHY?
Saulius Skeirys
 
TypeScript
TypeScriptTypeScript
Angular overview
Angular overviewAngular overview
Angular overview
Thanvilahari
 
Angular
AngularAngular
Angular
sridhiya
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
Nascenia IT
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
Shailendra Chauhan
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
André Pitombeira
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
Iwan van der Kleijn
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
Samundra khatri
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
Rob Eisenberg
 
TypeScript
TypeScriptTypeScript
TypeScript
Fabian Vilers
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
Reactjs
Reactjs Reactjs
Reactjs
Neha Sharma
 

What's hot (20)

TypeScript intro
TypeScript introTypeScript intro
TypeScript intro
 
Why TypeScript?
Why TypeScript?Why TypeScript?
Why TypeScript?
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best 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
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Basics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdfBasics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdf
 
Typescript in React: HOW & WHY?
Typescript in React: HOW & WHY?Typescript in React: HOW & WHY?
Typescript in React: HOW & WHY?
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Angular overview
Angular overviewAngular overview
Angular overview
 
Angular
AngularAngular
Angular
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 
TypeScript
TypeScriptTypeScript
TypeScript
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
Reactjs
Reactjs Reactjs
Reactjs
 

Viewers also liked

Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
Offirmo
 
Typescript
TypescriptTypescript
Typescript
Nikhil Thomas
 
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
MoscowJS
 
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
Rutenis Turcinas
 
002. Introducere in type script
002. Introducere in type script002. Introducere in type script
002. Introducere in type script
Dmitrii Stoian
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
Yakov Fain
 
Александр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in actionАлександр Русаков - TypeScript 2 in action
Александр Русаков - TypeScript 2 in action
MoscowJS
 
Typescript + Graphql = <3
Typescript + Graphql = <3Typescript + Graphql = <3
Typescript + Graphql = <3
felixbillon
 
TypeScript
TypeScriptTypeScript
TypeScript
GetDev.NET
 
Angular 2 - Typescript
Angular 2  - TypescriptAngular 2  - Typescript
Angular 2 - Typescript
Nathan Krasney
 
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
Ontico
 
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
Micael Gallego
 
Typescript tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricks
Ori Calvo
 
TypeScript Seminar
TypeScript SeminarTypeScript Seminar
TypeScript Seminar
Haim Michael
 
TypeScriptで快適javascript
TypeScriptで快適javascriptTypeScriptで快適javascript
TypeScriptで快適javascript
AfiruPain NaokiSoga
 

Viewers also liked (16)

Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
 
Typescript
TypescriptTypescript
Typescript
 
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
«Typescript: кому нужна строгая типизация?», Григорий Петров, MoscowJS 21
 
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
 
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 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
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Angular 2 - Typescript
Angular 2  - TypescriptAngular 2  - Typescript
Angular 2 - Typescript
 
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
TypeScript: особенности разработки / Александр Майоров (Tutu.ru)
 
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 tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricks
 
TypeScript Seminar
TypeScript SeminarTypeScript Seminar
TypeScript Seminar
 
TypeScriptで快適javascript
TypeScriptで快適javascriptTypeScriptで快適javascript
TypeScriptで快適javascript
 

Similar to TypeScript - An Introduction

TypeScript introduction to scalable javascript application
TypeScript introduction to scalable javascript applicationTypeScript introduction to scalable javascript application
TypeScript introduction to scalable javascript application
Andrea Paciolla
 
typescript.pptx
typescript.pptxtypescript.pptx
typescript.pptx
ZeynepOtu
 
Typescript: Beginner to Advanced
Typescript: Beginner to AdvancedTypescript: Beginner to Advanced
Typescript: Beginner to Advanced
Talentica Software
 
How I Learned to Stop Worrying and Love Typescript
How I Learned to Stop Worrying and Love TypescriptHow I Learned to Stop Worrying and Love Typescript
How I Learned to Stop Worrying and Love Typescript
Thomas O'Keefe
 
Python typing module
Python typing modulePython typing module
Python typing module
Ryan Blunden
 
Getting started with typescript and angular 2
Getting started with typescript  and angular 2Getting started with typescript  and angular 2
Getting started with typescript and angular 2
Knoldus Inc.
 
Software Craftmanship - Cours Polytech
Software Craftmanship - Cours PolytechSoftware Craftmanship - Cours Polytech
Software Craftmanship - Cours Polytech
yannick grenzinger
 
Type Script Conceitos de ts para projetos front-end React - por ruben marcus
Type Script   Conceitos de ts para projetos front-end React - por ruben marcusType Script   Conceitos de ts para projetos front-end React - por ruben marcus
Type Script Conceitos de ts para projetos front-end React - por ruben marcus
Ruben Marcus Luz Paschoarelli
 
Type script is awesome
Type script is awesomeType script is awesome
Type script is awesome
KeithMurgic
 
Static Type Checking with FlowJs
Static Type Checking with FlowJsStatic Type Checking with FlowJs
Static Type Checking with FlowJs
Unfold UI
 
Python made easy
Python made easy Python made easy
Python made easy
Abhishek kumar
 
Style & Design Principles 01 - Code Style & Structure
Style & Design Principles 01 - Code Style & StructureStyle & Design Principles 01 - Code Style & Structure
Style & Design Principles 01 - Code Style & Structure
Nick Pruehs
 
Type script
Type scriptType script
Type script
Zunair Shoes
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
NexThoughts Technologies
 
Getting Started with TypeScript
Getting Started with TypeScriptGetting Started with TypeScript
Getting Started with TypeScript
Gil Fink
 
Typescript-7 (1).pptx
Typescript-7 (1).pptxTypescript-7 (1).pptx
Typescript-7 (1).pptx
SachinSonawane100
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScript
EPAM Systems
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
Bhavsingh Maloth
 
Python for katana
Python for katanaPython for katana
Python for katana
kedar nath
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scripting
Amirul Shafeeq
 

Similar to TypeScript - An Introduction (20)

TypeScript introduction to scalable javascript application
TypeScript introduction to scalable javascript applicationTypeScript introduction to scalable javascript application
TypeScript introduction to scalable javascript application
 
typescript.pptx
typescript.pptxtypescript.pptx
typescript.pptx
 
Typescript: Beginner to Advanced
Typescript: Beginner to AdvancedTypescript: Beginner to Advanced
Typescript: Beginner to Advanced
 
How I Learned to Stop Worrying and Love Typescript
How I Learned to Stop Worrying and Love TypescriptHow I Learned to Stop Worrying and Love Typescript
How I Learned to Stop Worrying and Love Typescript
 
Python typing module
Python typing modulePython typing module
Python typing module
 
Getting started with typescript and angular 2
Getting started with typescript  and angular 2Getting started with typescript  and angular 2
Getting started with typescript and angular 2
 
Software Craftmanship - Cours Polytech
Software Craftmanship - Cours PolytechSoftware Craftmanship - Cours Polytech
Software Craftmanship - Cours Polytech
 
Type Script Conceitos de ts para projetos front-end React - por ruben marcus
Type Script   Conceitos de ts para projetos front-end React - por ruben marcusType Script   Conceitos de ts para projetos front-end React - por ruben marcus
Type Script Conceitos de ts para projetos front-end React - por ruben marcus
 
Type script is awesome
Type script is awesomeType script is awesome
Type script is awesome
 
Static Type Checking with FlowJs
Static Type Checking with FlowJsStatic Type Checking with FlowJs
Static Type Checking with FlowJs
 
Python made easy
Python made easy Python made easy
Python made easy
 
Style & Design Principles 01 - Code Style & Structure
Style & Design Principles 01 - Code Style & StructureStyle & Design Principles 01 - Code Style & Structure
Style & Design Principles 01 - Code Style & Structure
 
Type script
Type scriptType script
Type script
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Getting Started with TypeScript
Getting Started with TypeScriptGetting Started with TypeScript
Getting Started with TypeScript
 
Typescript-7 (1).pptx
Typescript-7 (1).pptxTypescript-7 (1).pptx
Typescript-7 (1).pptx
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScript
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
 
Python for katana
Python for katanaPython for katana
Python for katana
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scripting
 

More from NexThoughts Technologies

Alexa skill
Alexa skillAlexa skill
GraalVM
GraalVMGraalVM
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
NexThoughts Technologies
 
Apache commons
Apache commonsApache commons
Apache commons
NexThoughts Technologies
 
HazelCast
HazelCastHazelCast
MySQL Pro
MySQL ProMySQL Pro
Microservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & ReduxMicroservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & Redux
NexThoughts Technologies
 
Swagger
SwaggerSwagger
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
NexThoughts Technologies
 
Arango DB
Arango DBArango DB
Jython
JythonJython
Smart Contract samples
Smart Contract samplesSmart Contract samples
Smart Contract samples
NexThoughts Technologies
 
My Doc of geth
My Doc of gethMy Doc of geth
My Doc of geth
NexThoughts Technologies
 
Geth important commands
Geth important commandsGeth important commands
Geth important commands
NexThoughts Technologies
 
Ethereum genesis
Ethereum genesisEthereum genesis
Ethereum genesis
NexThoughts Technologies
 
Ethereum
EthereumEthereum
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
NexThoughts Technologies
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
NexThoughts Technologies
 
Google authentication
Google authenticationGoogle authentication
Google authentication
NexThoughts Technologies
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
NexThoughts Technologies
 

More from NexThoughts Technologies (20)

Alexa skill
Alexa skillAlexa skill
Alexa skill
 
GraalVM
GraalVMGraalVM
GraalVM
 
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
 
Apache commons
Apache commonsApache commons
Apache commons
 
HazelCast
HazelCastHazelCast
HazelCast
 
MySQL Pro
MySQL ProMySQL Pro
MySQL Pro
 
Microservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & ReduxMicroservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & Redux
 
Swagger
SwaggerSwagger
Swagger
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Arango DB
Arango DBArango DB
Arango DB
 
Jython
JythonJython
Jython
 
Smart Contract samples
Smart Contract samplesSmart Contract samples
Smart Contract samples
 
My Doc of geth
My Doc of gethMy Doc of geth
My Doc of geth
 
Geth important commands
Geth important commandsGeth important commands
Geth important commands
 
Ethereum genesis
Ethereum genesisEthereum genesis
Ethereum genesis
 
Ethereum
EthereumEthereum
Ethereum
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
 
Google authentication
Google authenticationGoogle authentication
Google authentication
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 

Recently uploaded (20)

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 

TypeScript - An Introduction

  • 2. Hello! I am Hiten Pratap Singh I am here because I love to dive into new interesting things. You can find me at: https://github.com/hitenpratap/ https://hprog99.wordpress.com/ hiten@nexthoughts.com
  • 3. Agenda ▷ Introduction ▷ Installation ▷ Why TypeScript? ▷ Features ▷ Comparison With TypeScript Alternatives ▷ Who Uses TypeScript? ▷ Conclusion
  • 5. “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.
  • 6. Overview ▷ Syntax based on ECMAScript 4 & ECMASCript 6 proposals ▷ TS is first and foremost a superset of JS ▷ Any regular Javascript is valid TypeScript Code
  • 7. “Microsoft's TypeScript may be the best of the many JavaScript front ends. It seems to generate the most attractive code.” - Douglas Crockford "CoffeeScript is to Ruby as TypeScript is to Java/C#/C++." - Luke Hoban
  • 9. How To Install For more details check: https://www.typescriptlang.org/docs/tutorial.html Via npm (the Node.js package manager) By installing TypeScript’s Visual Studio plugins Just download any appropriate Visual Studio from Microsoft site and you are all set to go. You can also try Visual Studio Code IDE from https://code.visualstudio.com/ which is free, open source and available for multi-platform.
  • 10. 3. Why TypeScript? Why everyone is using it more and more.
  • 11. Main Goals of TypeScript ▷ Provide an optional type system for JavaScript. ▷ Provide planned features from future JavaScript editions to current JavaScript engines ▷ Modular Development
  • 13. TypeScript Features ▷ Data Types Supported ▷ Optional Static Type Annotation ▷ Classes ▷ Interface ▷ Modules ▷ Arrow Expressions ▷ Type Assertions ▷ Ambient Declarations ▷ Source File Dependencies
  • 15. ▷ Any ▷ Primitive - Number - Boolean - String - Void - Null - Undefined - Same as JS ▷ Array ▷ Enum
  • 16. Any is used when it’s impossible to determine the type Any
  • 17. ▷ Doesn’t have separate integers and float/double type. These all are floating point values and get the type ‘number’ ▷ boolean - true/false value ▷ string - both single/double quote can be used ▷ No separate char type ▷ void - is used in function type returning nothing ▷ null and undefined - functions as usual Primitive
  • 18. Array
  • 19. By default, enums begin numbering their members starting at 0. You can change this by manually setting the value of one its members. Enum
  • 22. Type Inference ▷ TypeScript tries to infer types ▷ Four ways to variable declaration - - Type and Value in one statement - Type but no Value then Value will be undefined - Value but on Type then the it will be of Any type but maybe be inferred based on its value. - Neither Value nor Type then Type will be Any and Value will be undefined.
  • 24. ▷ Can implement interfaces ▷ Inheritance ▷ Instance methods/members ▷ Static methods/members ▷ Single constructor ▷ Default/Optional parameter ▷ ES6 class syntax TypeScript Classes
  • 27. ▷ Declared using interface keyword ▷ Like other TS features it’s design time features i.e. no extra code would be emitted to resultant JS file ▷ Errors being shown when interface signature and implementation doesn’t match. TypeScript Interfaces
  • 30. ▷ Modules can be defined using module keyword ▷ A module can contains sub-modules, class, enums or interfaces. But can’t directly contains functions. ▷ Modules can be nested(sub-modules). ▷ Classes and Interfaces can be exposed using export keyword. TypeScript Modules
  • 33. ▷ Implicit return ▷ No braces for single expression ▷ Part of ES6 ▷ Lexically scoped this ▷ You don't need to keep typing function ▷ It lexically captures the meaning of arguments Arrow Expressions
  • 36. TypeScript's type assertion are purely you telling the compiler that you know about the types better than it does, and that it should not second guess you. Type Assertions
  • 39. A major design goal of TypeScript was to make it possible for you to safely and easily use existing JavaScript libraries in TypeScript. TypeScript does this by means of declaration. Ambient Declarations
  • 41. ▷ Can be done using reference keyword ▷ Must be the first statement of file ▷ Paths are relative to the current file ▷ Can also be done using tsconfig file Source File Dependencies
  • 44. ▷ Complete language + Runtime overhaul ▷ More features: generators, comprehensions, object literals etc ▷ Will take years before widely deployed ▷ No typing as of now(Maybe ES7) TypeScript VS ES6 Harmony
  • 45. ▷ Also a superset to JavaScript ▷ More syntactic sugar, still dynamically typed ▷ Unlike TypeScript, JS is not valid CoffeeScript code ▷ It doesn’t track ECMAScript 6 TypeScript VS CoffeeScript
  • 46. ▷ Optionally typed ▷ A native VM ▷ Operator overloading ▷ ECMAScript Dart spec ▷ Completely different syntax and semantics than JS TypeScript VS DART
  • 50. Pros: ▷ High value, low cost improvement over JavaScript ▷ Safer and more modular ▷ Solid path to ECMAScript 6 Cons: ▷ Still need to know some JS quirks ▷ Current compiler slowish(Faster one is in development) Conclusion
  • 51. Thanks! Any questions? You can find me at: https://github.com/hitenpratap/ https://hprog99.wordpress.com/ hiten@nexthoughts.com
  • 52. References ▷ https://www.typescriptlang.org/docs/tutorial.html ▷ https://learnxinyminutes.com/docs/typescript/ ▷ https://basarat.gitbooks.io/typescript/content/ ▷ http://www.slideshare.net/SanderMak/typescript-coding-javascript- without-the-pain ▷ http://www.slideshare.net/aniruddha.chakrabarti/typescript-44668095