Build JavaScript applications using TypeScript
- student
- developer
- intermediate
- TypeScript
- Familiarity with basic HTML and JavaScript ES6/2015, including:
- Conditionals
- Functions
- Scope
- Arrays
- Loops
- Iterators
- Objects
- Classes
- Modules
- Installed software:
- Git
- Visual Studio Code
- Node.js
- TypeScript
TypeScript offers all the features of JavaScript, plus an additional layer on top of these: The TypeScript type system. In this learning path, you’ll learn how using TypeScript for JavaScript development can help you build more robust code, reduce runtime type errors, take advantage of modern features before they are available in JavaScript, and work better with development teams.
- Set up a TypeScript development environment.
- Declare variable types.
- Implement interfaces.
- Develop typed functions.
- Declare and instantiate classes.
- Apply generic types to functions, interfaces, and classes.
- Work with external libraries.
- Organize TypeScript code using namespaces and modules.
Identify the subtasks of module title
Subtask | What part of the introduction scenario does this subtask satisfy? | How will you assess it: Exercise or Knowledge check? | Which learning objective(s) does this help meet? | Does the subtask have enough learning content to justify an entire unit? If not, which other subtask will you combine it with? |
---|---|---|---|---|
TODO | TODO | TODO | TODO | TODO |
TODO | TODO | TODO | TODO | TODO |
TODO | TODO | TODO | TODO | TODO |
-
Get started with TypeScript
This module introduces you to the TypeScript language, why it was created, and how you can benefit by using it for JavaScript development. You'll also set up a TypeScript development environment to prepare you to complete future exercises.
- Introduction
- Overview of TypeScript
- Exercise - Select a TypeScript editor
- Exercise - Install the TypeScript compiler
- Compile a TypeScript file
- Exercise - Set up a TypeScript project
- Knowledge Check
- Summary
-
Declare variable types in TypeScript
The static type system in TypeScript enables you to describe the shape of an object, providing better documentation, and allowing TypeScript to validate that your code is working correctly. In TypeScript, declarations of namespaces, classes, properties, functions, variables, and other language entities associate types with those entities. This module introduces some of the available types and shows how to associate them with variables.
- Introduction
- Overview of types
- Primitive types
- Exercise - Enums
- Any and unknown types
- Union and intersection types
- Collection types
- Lab
- Knowledge Check
- Summary
-
Implement interfaces in TypeScript
In TypeScript, you can use interfaces as you would in traditional object-oriented programming. You can also use interfaces to define object types and this is the primary focus of this module.
- Introduction
- Introduction to interfaces in TypeScript
- Exercise - Declare and instantiate an interface
- Exercise - Extend an interface
- Other ways to use interfaces
- Lab
- Knowledge Check
- Summary
-
Develop typed functions using TypeScript
If you know how to write functions in JavaScript, you know how to write functions in TypeScript. In this module, you'll learn about the new capabilities that TypeScript add to the standard JavaScript functions to make them easier to work with.
- Introduction
- Create functions in TypeScript
- Exercise - Create functions
- Fun with parameters
- Exercise - Fun with parameters
- Exercise - Define function types
- Lab
- Knowledge Check
- Summary
-
Declare and instantiate classes in TypeScript
In this modules, you'll learn how TypeScript type annotations for class members, access modifiers, and the ability to specify required or optional parameters extend ES6 class functionality and provide additional benefits.
- Introduction
- Introduction to classes in TypeScript
- Exercise - Create a class
- Exercise - Instantiate a class
- Access modifiers
- Exercise - Apply access modifiers
- Define static properties
- Extend a class using inheritance
- Exercise - Extend a class
- Exercise - Declare an interface to ensure class shape
- Design considerations
- Lab
- Knowledge Check
- Summary
-
Define generics in TypeScript
While generics are supported by many programming languages, including TypeScript, they are not currently available in JavaScript. In this module, you'll learn how to apply generics to functions, interfaces, and classes.
- Introduction
- Introduction to generics
- Using methods and properties of a generic type
- Exercise - Implement generics with interfaces and classes
- Implement generics with custom types and classes
- Lab
- Knowledge Check
- Summary
-
Access external libraries from TypeScript
This module introduces you to organzing code in TypeScript using modules and accessing external type libraries.
- Introduction
- Organize code using modules
- Exercise - Export and import module components
- Exercise - Compile modules
- Exercise - Access external type libraries
- Lab
- Knowledge Check
- Summary
-
Organize code using TypeScript namespaces
TypeScript provides two ways to organize code: Namespaces and modules. This module explains how to organize TypeScript code using namespaces. While both namespaces and modules provide a way to categorize related code in meaningful ways and help you control which code is exposed to the global namespace of your applications, there are some differences between them.
- Introduction
- Introduction to TypeScript namespaces
- Exercise - Organize code using a single file namespace
- Organize code using multi-file namespaces
- Design considerations
- Lab
- Knowledge Check
- Summary
Note any additional information that may be beneficial to this content such as links, reference material, etc.