Intermediate
Accept Books Too
label takes anything with a name. The last line passes a book object with an extra pages member, and TypeScript reports an excess property error on that fresh literal.
Change only the parameter type of label so that books with an optional pages count are accepted, while an object with some other unknown member (like colour) is still rejected.
What Check tests
- Your code has no type errors
- The console prints
PENandBOOK - A book with a page count is accepted
- An unknown member is still rejected
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Press Run to see the page.
Console
Nothing printed yet.