Types & Interfaces
TypeScript adds static typing to JavaScript. Learn primitive types, object shapes with interfaces, and when to use type vs interface. This outline is in progress — expect a short read until full lessons ship.
Check your understanding
When might you prefer interface over type for an object shape?Show answerHide answer
Answer
Interfaces declare object shapes and can be extended/merged; type aliases are better for unions and mapped types. Either works for simple objects.What problem does TypeScript catch that plain JS misses until runtime?Show answerHide answer
Answer
Static type errors — calling a function with the wrong argument shape, accessing missing properties, and similar mistakes.