AI Features

Creating a strongly-typed object

In this lesson, we'll learn how TypeScript infers the types of objects and how to explicitly specify object type annotations ourselves.

Inferred object types

In the code below, what has TypeScript inferred the type of tomScore to be?

const tomScore = {
name: "Tom",
score: 70
}

Later in the program, if we change the score ...