Skip to content

Lesson 17 (TypeScript)

Courtney Frey edited this page Apr 14, 2022 · 2 revisions

Lesson 17: TypeScript

In the prep work this lesson, the students learned:

  1. What TypeScript is and how it is different from JavaScript.
  2. The differences between static and dynamic typing.
  3. How to declare and use:
    1. Variables of number, string, and boolean types.
    2. Arrays and tuples.
    3. Classes and interfaces.
  4. How to use export and import.
  5. How to use the implements keyword to make classes implement interfaces.

Large Group Time (Instructor Notes)

Announcements

  1. Check with your class Candidate Engagement Manager for any other announcements.
  2. Remind the students about the requirements for remaining in the course after Unit 1.

For Part-Time Students:

  1. Graded assignment #6 opens soon. This is the last graded assignment for unit 1.

For Full-Time Students:

  • Welcome do Days 25 and 26!
  • Graded Assignment 5 due end of Day 29
  • Day 25:
    • Lesson 17
  • Day 26:
    • Self-Assessment 3 in the morning (last one for Unit 1)
    • Work day for Assignment 5 rest of day

Topics That Require More Attention

  1. Be ready to answer the question, "Why do we need to learn TypeScript?"
  2. Q & A as needed for the prep-work exercises.
  3. Review the distinction between classes and interfaces in TypeScript. This comes directly from the last concept check in the reading.
  4. Review the syntax for function declarations in TypeScript:
    1. The type must be identified for each parameter.
    2. If a value is returned, the type for that value must also be identified.
  5. Note that when a TypeScript file is compiled, the process generates a JavaScript file that can be run.
  6. Studio intro.

Studio (TF Notes)

  1. The GitHub repository for the TypeScript chapter contains starter code and solutions for both the exercises and the studio.
  2. Remind the students that they need to be in the master branch of the repository. Also remind them to switch to the "studio" folder to find the starter code.
  3. One common mistake is to declare the Astronaut, Cargo, and Rocket classes in the same file instead of in three separate TypeScript files.
  4. Be ready to answer questions about when and where each class needs to be imported. Encourage your students to read through the entire studio description and sketch the relationships between each class.
  5. The code the students paste into index.ts should be good as-is. Despite the temptation to do so, the students should avoid modifying the code until after they have the studio working as described in the instructions.