TypeScript Basic Types
The core types are number, string and boolean. For a list, write the item type followed by [], for example number[].
let done: boolean = true
let scores: number[] = [10, 20, 30]
Try it yourself
Loading editor…
If you assign the wrong type — say a string to a number — TypeScript flags it. The editor still runs the transpiled JavaScript so you can see the result.