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:
- The TypeScript Handbook
- TypeScript Discord Page
- The comments on each Dev.to posts!
- Beginners may want to check out this page from the TypeScript Handbook
Happy Typing :)
Top comments (10)
:)
typescriptlang.org/play?#code/PTAE...
The first challenge has a typo:
Line 39:
I think that was the intention, stop using any and forget about typos
beginner: typescriptlang.org/play?#code/PTAE...
advanced: typescriptlang.org/play?#code/PTAE...
This was fun! Thanks :)
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 bit.ly/3opCmxr
You should use index access to get the type of
hauntings
array element. That way there will be no duplication in types.Solution
SO answer
Thank you Alex 😊
The second links seems to be exactly the same as the first one? @gcrev93
@gcrev93 , cool challenge! Count me in. 🎃👻