TypeScript basicsbeginner
A type is a note to your future self that the compiler checks — annotating what goes in and what comes out is where most of the value is, before any advanced feature.
Three hand-copied versions of MenuItem have drifted: one lost spicy, two let a caller choose the id, and the update replaces the whole item with the patch. Derive them from MenuItem instead, and protect the menu.
The derived types refuse what they should, the menu cannot be changed from outside, and add and update behave.
Published in full, before you start — every point is one of these and there is nothing else. Each one runs your code; it is not a search for keywords.
A type is a note to your future self that the compiler checks — annotating what goes in and what comes out is where most of the value is, before any advanced feature.