All academies
All challenges

Slim Types with Pick and Omit

mediumutility-types100 XP

Problem

Given an interface Article with id (number), title (string), body (string), and authorId (number), derive a type ArticlePreview using Pick that keeps only id and title, and write toPreview(article: Article): ArticlePreview. Also derive ArticleDraft using Omit to drop id, and create a draft value to show it has exactly three keys.

Expected output

{"id":1,"title":"Hello TS"}
keys: 3

Hints

Stuck? Reveal hints one at a time.

Solution

Try solving it yourself first — revealing is always available.

Press Run in the editor — your console output is checked automatically.
No errors
Loading...

Console output appears here. Press Run or just type — the code compiles automatically.