DEV Community

Cover image for Type | Treat 2021 - Day 1
Orta for typescript

Posted on • Edited on

Type | Treat 2021 - Day 1

Type or Treat Challenges

Today we're starting up our second year of Type | Treat (or "Type or Treat".) We will be presenting some "spooky" code challenges that will allow you to dig deeper into the TypeScript language in a fun way.

Starting right now, a new code challenge will be posted every weekday, along with its solution the day after. The last solution will be posted on the weekend.

How To Participate

In order to participate you only need to be able to access the TypeScript website. Though ideally, you share with us your answers via our dev.to blog post mirrors, here, or via Twitter to @TypeScript.

You will want to start here on the blog to find the details on the code challenges for the day. Each post contains 2 links to different challenges which run in the TypeScript playground. Via the playground, you can work on the challenge in your browser and you will be able to test your code live to see if it properly passes the challenge.

How To Share Your Solution

Once you feel you have completed the challenge, you will need to select the Share button in the playground. This will automatically copy a playground URL to your clipboard.

Then either:

  • Go to Twitter, and create a tweet about the challenge, add the link to your code and mention the @TypeScript Twitter account with the hashtag #TypeOrTreat.

  • Leave us a comment with your feedback on the dev.to post, or in this post.

Best Resources for Additional Help

If you need additional help you can utilize the following:

Day 1 Challenges

Beginner/Learner Challenge

Using the new music streaming service from the TypeScript team, Typify, set up and share your halloween playlist with your friends.

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

Intermediate/Advanced Challenge

You've figured out your costume, but making it is a bit of a process. Can you figure out how to make all of the parts come together in a type-safe way?

Head over to start sorting.

Oldest comments (24)

Collapse
 
aleclofabbro profile image
Alessandro Giansanti

Hi there!
going to be fun :) here's my solution:

Collapse
 
jaxp profile image
Jakub Patočka

Is it supposed to be runnable? I get an error right after opening the playground link.

Cannot use import statement outside a module

Collapse
 
orta profile image
Orta typescript

It's not - the Playground can get types from npm modules but not the runtime code, so any time the runtime sees an import the JS bails.

Collapse
 
stefanhoutzager profile image
Stefan Houtzager
Collapse
 
anuraghazra profile image
Anurag Hazra

The links seems to be broken.
dev.to/play?#gist/927ccc66ae3022dc...

Collapse
 
wimzylive profile image
Rushi Patel
Collapse
 
belinde profile image
Franco Traversaro
Collapse
 
brunagarcia profile image
Bruna Garcia

Channeling my inner dj with the this challenge 🎃 any inputs are welcome my TS playground

Collapse
 
jmcscript profile image
James McDonald

Quickie: bit.ly/3vUEhhG

Collapse
 
jmcscript profile image
James McDonald

Intermediate Challenge: bit.ly/3bboVMb

Collapse
 
orta profile image
Orta typescript

Oops! Links are updated, great solutions folks!