Typescript — The Basics

  1. Types
function addTwo(num) {
return num + 2;
}
function addTwo(num: number) {
return num + 2;
}
type List = [string, number, boolean]const myArray: List = [“word”, 1, true]
type List = [string, number, boolean?]const myArray: List = [“word”, 1]

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store