DEV Community

Gabrielle Crevecoeur for typescript

Posted on • Edited on

24 3

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 :)

Redis image

62% faster than every other vector database 💨

Tired of slow, inaccurate vector search?
Redis delivers top recall and low latency, outperforming leading vector databases in recent benchmarks. With built-in ANN and easy scaling, it’s a fast, reliable choice for real-time AI apps.

Get started

Top comments (10)

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

The first challenge has a typo:

typo

Line 39:

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

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

Collapse
 
lifeiscontent profile image
Aaron Reisman • Edited
Collapse
 
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 bit.ly/3opCmxr

Collapse
 
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.

Solution
SO answer

Collapse
 
santoshyadavdev profile image
Santosh Yadav

Thank you Alex 😊

Collapse
 
sleeplessbyte profile image
Derk-Jan Karrenbeld

This was fun! Thanks :)

Collapse
 
zhigang1992 profile image
Zhigang Fang

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

Collapse
 
bennycode profile image
Benny Code

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

Gen AI apps are built with MongoDB Atlas

Gen AI apps are built with MongoDB Atlas

MongoDB Atlas is the developer-friendly database for building, scaling, and running gen AI & LLM apps—no separate vector DB needed. Enjoy native vector search, 115+ regions, and flexible document modeling. Build AI faster, all in one place.

Start Free

👋 Kindness is contagious

Delve into a trove of insights in this thoughtful post, celebrated by the welcoming DEV Community. Programmers of every stripe are invited to share their viewpoints and enrich our collective expertise.

A simple “thank you” can brighten someone’s day—drop yours in the comments below!

On DEV, exchanging knowledge lightens our path and forges deeper connections. Found this valuable? A quick note of gratitude to the author can make all the difference.

Get Started