SlideShare a Scribd company logo
Type script in practice
Type script in practice
https://aka.ms/nebrius-svcc18-this
function combineNames(first: string, last: string): string {
return `${first} ${last}`;
}
const firstName: string = 'Philip';
const lastName: string = 'Fry';
console.log(combineNames(firstName, lastName));
https://aka.ms/nebrius-svcc18-this
interface IPerson {
firstName: string;
lastName: string;
age: number;
}
const fry: IPerson = {
firstName: 'Philip',
lastName: 'Fry',
age: 30
}
https://aka.ms/nebrius-svcc18-this
interface IShip {
name: string;
takeoff(): void;
}
class Ship implements IShip {
private shipName: string;
public get name() {
return this.shipName;
}
public takeoff(): void {
// Blastoff!
}
} https://aka.ms/nebrius-svcc18-this
import { IShip } from './IShip';
export class Ship implements IShip {
private shipName: string;
public get name() {
return this.shipName;
}
public takeoff(): void {
// Blastoff!
}
}
https://aka.ms/nebrius-svcc18-this
https://aka.ms/nebrius-svcc18-this
Type script in practice
https://aka.ms/nebrius-svcc18-this
➡
https://aka.ms/nebrius-svcc18-this
https://aka.ms/nebrius-svcc18-this
Type script in practice
https://aka.ms/nebrius-svcc18-this
https://aka.ms/nebrius-svcc18-this
https://aka.ms/nebrius-svcc18-this
Type script in practice
https://aka.ms/nebrius-svcc18-this
declare module "planet" {
export function visit(): void;
export function getCities(): City[];
export interface City {
population: number;
founded: Date;
}
}
https://aka.ms/nebrius-svcc18-this
https://aka.ms/nebrius-svcc18-this
https://aka.ms/nebrius-svcc18-this
Type script in practice
https://aka.ms/nebrius-svcc18-this
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"outDir": "dist",
"sourceMap": true
},
"include": [
"src/**/*.ts"
]
}
https://aka.ms/nebrius-svcc18-this
https://aka.ms/nebrius-svcc18-this
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"quotemark": "single",
"semicolon": "always",
"trailing-comma": "never"
},
"rulesDirectory": []
}
https://aka.ms/nebrius-svcc18-this
Type script in practice
import { ItemView } from 'ItemView';
import * as React from 'react';
export interface IContainerProps {
items: string[];
}
export class ContainerView extends React.Component<IContainerProps, null> {
public render() {
return (
<div className="container">
{this.props.items.map((item) => (<ItemView item={item} />))}
</div>
);
}
}
https://aka.ms/nebrius-svcc18-this
https://aka.ms/nebrius-svcc18-this
module.exports = {
entry: "./src/index.tsx",
output: {
filename: "bundle.js",
path: "./dist"
},
// Enable sourcemaps for debugging webpack's output.
devtool: “inline-source-map",
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".json"]
},
// Continued on next slide
https://aka.ms/nebrius-svcc18-this
// Continued from previous slide
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
{ test: /.tsx?$/, use: "ts-loader", exclude: /node_modules/ }
]
}
};
https://aka.ms/nebrius-svcc18-this
https://aka.ms/nebrius-svcc18-this
Type script in practice
Bryan Hughes, @nebrius
https://aka.ms/nebrius-svcc18-this

More Related Content

PPTX
Perl: Coro asynchronous
PDF
PPTX
Cyclone + Eventsource (realtime push-сообщения)
PPTX
Modern JS with ES6
PDF
ES2015 (ES6) Overview
PDF
LLVM Workshop Osaka Umeda, Japan
PDF
EcmaScript 6 - The future is here
PDF
Продвинутая отладка JavaScript с помощью Chrome Dev Tools
Perl: Coro asynchronous
Cyclone + Eventsource (realtime push-сообщения)
Modern JS with ES6
ES2015 (ES6) Overview
LLVM Workshop Osaka Umeda, Japan
EcmaScript 6 - The future is here
Продвинутая отладка JavaScript с помощью Chrome Dev Tools

What's hot (20)

TXT
Source Code
PDF
Rcpp11 useR2014
PPTX
Introduction to kotlin and OOP in Kotlin
PDF
Go Concurrency
PDF
Goroutines and Channels in practice
PDF
Golang Channels
PDF
Crystal Rocks
PPTX
PDF
Primi passi con Project Tango
PDF
Javascript ES6 generators
PDF
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
PDF
Introduction to kotlin coroutines
PDF
Go Containers
PDF
Gogo shell
PDF
Docker tips & tricks
PDF
PDF
ES6 generators
KEY
Beauty and Power of Go
PPTX
Visualizing ORACLE performance data with R @ #C16LV
DOCX
RedHat/CentOs Commands for administrative works
Source Code
Rcpp11 useR2014
Introduction to kotlin and OOP in Kotlin
Go Concurrency
Goroutines and Channels in practice
Golang Channels
Crystal Rocks
Primi passi con Project Tango
Javascript ES6 generators
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
Introduction to kotlin coroutines
Go Containers
Gogo shell
Docker tips & tricks
ES6 generators
Beauty and Power of Go
Visualizing ORACLE performance data with R @ #C16LV
RedHat/CentOs Commands for administrative works
Ad

Similar to Type script in practice (13)

PPTX
Corinna-2023.pptx
PDF
JavaScript Survival Guide
PPT
Inheritance compiler support
PDF
Bologna Developer Zone - About Kotlin
PDF
Data structuresUsing java language and develop a prot.pdf
PDF
Best practices for crafting high quality PHP apps (php[world] 2019)
PDF
Best practices for crafting high quality PHP apps (Bulgaria 2019)
PDF
Unleash the Power of Symfony Messenger
PDF
ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...
ODP
Groovy Ast Transformations (greach)
PDF
Crafting Quality PHP Applications (PHP Joburg Oct 2019)
PDF
Grailsでドメイン駆動設計を実践する時の勘所
PDF
The_Borrow_Checker.pdf
Corinna-2023.pptx
JavaScript Survival Guide
Inheritance compiler support
Bologna Developer Zone - About Kotlin
Data structuresUsing java language and develop a prot.pdf
Best practices for crafting high quality PHP apps (php[world] 2019)
Best practices for crafting high quality PHP apps (Bulgaria 2019)
Unleash the Power of Symfony Messenger
ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...
Groovy Ast Transformations (greach)
Crafting Quality PHP Applications (PHP Joburg Oct 2019)
Grailsでドメイン駆動設計を実践する時の勘所
The_Borrow_Checker.pdf
Ad

Recently uploaded (20)

PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
AI in Product Development-omnex systems
PDF
Nekopoi APK 2025 free lastest update
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPT
Introduction Database Management System for Course Database
PDF
Digital Strategies for Manufacturing Companies
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Introduction to Artificial Intelligence
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
medical staffing services at VALiNTRY
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
System and Network Administration Chapter 2
PDF
Odoo Companies in India – Driving Business Transformation.pdf
Odoo POS Development Services by CandidRoot Solutions
ISO 45001 Occupational Health and Safety Management System
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Design an Analysis of Algorithms II-SECS-1021-03
How Creative Agencies Leverage Project Management Software.pdf
AI in Product Development-omnex systems
Nekopoi APK 2025 free lastest update
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
PTS Company Brochure 2025 (1).pdf.......
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Introduction Database Management System for Course Database
Digital Strategies for Manufacturing Companies
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Introduction to Artificial Intelligence
Design an Analysis of Algorithms I-SECS-1021-03
medical staffing services at VALiNTRY
Wondershare Filmora 15 Crack With Activation Key [2025
System and Network Administration Chapter 2
Odoo Companies in India – Driving Business Transformation.pdf

Type script in practice