Introduction to TypeScript. Interfaces (opens in new tab)
Basic syntax We know that we can use object literals to specify what property types we can use. However, what if you have multiple objects with the same structure? Interface is a programming structure that allows to create types for objects. interface Settings { color: string; delay: number; retry: boolean; } const mySettings: Settings = { color: "black", delay: 1000, retry: false } console.log(mySettings.color); Pay attention that when we define interface we use "semicolon". Optional propert...
Read the original article