DEV Community

Gabrielle Crevecoeur for typescript

Posted on • Updated on

Type | Treat Challenge 1

Welcome to the first Type | Treat challenge! Today we will be extracting haunting data from ghosts and sorting Halloween candy!

The Challenge

Beginner/Learner Challenge

So the TypeScript team is being hired to investigate recent hauntings in the community, and we are trying to figure which ghost is the trouble-maker!

We found an API that will allow us to get data on the ghosts however, out code isn't fully optimized. So we need your help.

Head to this link and help us figure out the best type to use in one of our function parameters!

Intermediate/Advanced Challenge

Your kids have come back from trick or treating with a lot of loot. Someone's going to have to sort this pile, and it looks like that job has fallen to you. Can you conditionally filter the pile into manageable lists?

Head over to start sorting.

Share Your Code

Be sure to submit your solution by using the Share button in the TypeScript playground to copy the link to your clipboard.

Next go to Twitter, and create a tweet about the challenge, add the paste the link to your code and mention the TypeScript page (@typescript) !

Need Extra Help?

If you need additional help you can utilize the following:

Happy Typing :)

Top comments (10)

sebastienlorber profile image
Sebastien Lorber
wvankuipers profile image
W. van Kuipers

The first challenge has a typo:


Line 39:

-  console.log(`   ${haunting.provemance}`)
+  console.log(`   ${haunting.provenance}`)
Enter fullscreen mode Exit fullscreen mode
rodmax profile image
Maxim Rodionov

I think that was the intention, stop using any and forget about typos

lifeiscontent profile image
Aaron Reisman • Edited
sleeplessbyte profile image
Derk-Jan Karrenbeld

This was fun! Thanks :)

santoshyadavdev profile image
Santosh Yadav

Thank you this was fun, I solved both and tweeted it too, I am sure about 2nd solution but my first solution could have been better, any response appreciated

showmeyourhits profile image
Alex Ozhigin

You should use index access to get the type of hauntings array element. That way there will be no duplication in types.

SO answer

santoshyadavdev profile image
Santosh Yadav

Thank you Alex 😊

zhigang1992 profile image
Zhigang Fang

The second links seems to be exactly the same as the first one? @gcrev93

bennycode profile image
Benny Code

@gcrev93 , cool challenge! Count me in. 🎃👻