Whenever you access a specific index in an array, there’s a possibility that the result is undefined.
const meetings: string[] = [];const firstMeeting = meetings[0]; // undefined
Note: This post assumes basic understanding of Type narrowing via equality and the never type.
never
Many Typescript users have a love/hate relationship with enums. Admittedly, their current…
Note: Basic understanding of generics and intersection types are assumed in this piece.
Ever faced a bug that’s caused by feeding in the wrong id to a function? For instance, a function expects studentId, but you…
studentId
Suppose we have a ScoreSheet interface and a function which checks if some score sheet belongs to a student from the department of science:
ScoreSheet
interface ScoreSheet { mathematics: number; physics?: number…