TypeScript · Exercise 6 of 6 Previous
Advanced
Merge two interfaces and attach a counter
Settings is declared once with theme. Add a second interface Settings declaration that adds fontSize: number, so a Settings value needs both.
Then give the function counter a property calls (a number starting at 0) with a namespace after the function, and make the function add one to it each call.
What Check tests
- Your code has no type errors
- The program prints the settings and the call count
- A Settings value without fontSize is rejected
- counter.calls is a number
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.