Skip to content

Latest commit

 

History

History

06-challenge

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Challenge 06

[Conversation in the #bugs company Slack channel.]

[🎅 Santa] How do you hoofed halfwits manage to screw up something a toddler with a crayon could figure out? I asked for the simplest thing I could imagine and you still couldn't do it! If you had two brain cells to rub together you'd understand that only numbers or strings are valid route identifiers!

[🌩️ Donner] Please make a thead in this Slack channel, otherwise it gets too noisy and hard to follow. Also our Linear thing just made 3 tickets for each of your messages.

[🎅 Santa] I am old school, I prefer IRC-style chatter. I do not value these "thread" things and find them difficult to use. I'll never do it, myself.

[🌟 Vixen, in a thread] This isn’t 1997, Santa. Nobody cares about your IRC war stories. This is a company support channel with integrations designed to run the company better. How are you seriously against that??

[🎅 Santa] I'm not against that, I'm just against using threads in chat apps.

Clearly we need to constrain our generic type a bit to only allow specific data types. 🎅 Santa will probably also complain about that, but so it goes.

Hint You might need to "extend" the solution from Day 4.

Expected Behavior

const oneMill = createRoute('🌩️Donner', 100_000_000)

type Actual01 = typeof oneMill // => 100000000
type Expected01 = 100_000_000 // => 100000000

const two = createRoute('🔴Rudolph', 2)

type Actual02 = typeof two // => 2
type Expected02 = 2 // => 2

const three = createRoute('💨Dasher', '3')

type Actual03 = typeof three // => '3'
type Expected03 = '3' // => '3'

// @ts-expect-error
createRoute('🌟Vixen', true)

// @ts-expect-error
createRoute('💃Dancer', [1])

// @ts-expect-error
createRoute('☄️Comet', { 1: 1 })

Prompt by Dimitri Mitropoulos of Michigan TypeScript.

Code by Dimitri Mitropoulos of SquiggleConf.