TypeScript · Exercise 1 of 6Next
Beginner
Only These Directions
The function move accepts any text, so a typo like "lef" gets through. Change the type Direction so only "up", "down", "left" and "right" are allowed.
The checks call move("sideways") and expect TypeScript to reject it, and call move("up") and expect it to be accepted.
What Check tests
- Your code has no type errors
move("sideways")is rejectedmove("up")is accepted- The console prints
moving left
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.