How to Train Your
JavaScript

An Introduction to TypeScript

And the Benefits It Brings

@dapperdandev

 

Code: github.com/djbreen7/typescript-demo

 

About Me

  • Graduated from DevPoint Labs in Fall 2015
  • Completed "Mastering C#" at Boise Code Works in 2018
  • Software Developer at Royal Jay
  • Terrible at making slideshows

Hobbies

 

  • Rock Climbing
  • Snowboarding
  • Jump rope (newer)

...also, I pronounce "gif" like "gift",

but...

Say "Sun"

..."Son"

..."Jay"

..."J"

..."SON"

JSON

Overview

We'll be exploring TypeScript and the benefits it brings to the JavaScript ecosystem including:

 

  • What it is
  • What it isn't
  • What it does
  • Why use it

Goals

Goal 1:

To show you some of the benefits of TypeScript you may not have been aware of.

 

Goal 2:

Debunk the myth that TypeScript is strictly for OOP.

Disclaimer

TypeScript has great features for OOP that will be talked about

What Typescript Is

TypeScript is a superset of JavaScript. In other words, JavaScript is valid TypeScript*.

 

TypeScript adds optional static typing to JavaScript. Additionally, it provides developers with other language features such as interfaces, generics, and enums.

What Typescript Isn't

  • A genie. You can still write bad code.
  • A replacement.
  • An OOP Language.

Why Use It

  • Strict null checking
  • You prefer strongly typed languages
  • You want to use ESNext features now
  • Better IDE/Code Editor support
  • Strong community
  • Wide adoption

Disclaimer

I'm not perfect

Examples!

Typos

JavaScript

Typos

TypeScript

Null Checks

JavaScript

Also...

Null Checks

TypeScript

 

Also...

Interfaces Are Free!

Type Safety

JavaScript

Type Safety

TypeScript

 

Access Modifiers

JavaScript

Access Modifiers

TypeScript

Module Resolution

@dapperdandev

 

github.com/djbreen7/typescript-demo

 

Made with Slides.com