scrimba
Learn TypeScript
Optional properties (6)
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Optional properties (6)
AboutCommentsNotes
Optional properties (6)
Expand for more info
index.ts
run
preview
console
type Address = {
street: string
city: string
country: string
}

type Person = {
name: string
age: number
isStudent: boolean
address: Address
}

let person1: Person = {
name: "Joe",
age: 42,
isStudent: true,
address: {
street: "123 Main",
city: "Anytown",
country: "USA"
}
}

let person2: Person = {
name: "Jill",
age: 66,
isStudent: false,
address: {
street: "123 Main",
city: "Anytown",
country: "USA"
}
}
Console
/index.html
-2:41