News for hackers. Stuff that matters.
Re:Bad TypeScript Habits by h1fra on Tuesday February 02, 2021 @03:15PM (#26006006)
I think the code sample after `Use the new ?? operator, or, even better, define the fallback right at the parameter level.` is not correct, it stops after new Date without any mention of ??

edit: read too fast :facepalm:

Re:Bad TypeScript Habits by jgwil2 on Tuesday February 02, 2021 @03:20PM (#26006079)
Yeah, the example just shows the "even better" option: it gives a default value for the date parameter.
Re:Bad TypeScript Habits by ulucs on Tuesday February 02, 2021 @03:19PM (#26006062)
It's defined at the parameter level, using function parameter defaults
Re:Bad TypeScript Habits by dbartholomae on Tuesday February 02, 2021 @03:18PM (#26006054)
It uses a fallback at parameter level instead of the ?? operator.
Re:Bad TypeScript Habits by h1fra on Tuesday February 02, 2021 @03:22PM (#26006102)
oops indeed, but I'm not crazy there was a missing parathensis no? It's too late :D

Anyway great blog post

Re:Bad TypeScript Habits by dbartholomae on Tuesday February 02, 2021 @03:30PM (#26006201)
Yes, someone found the typo, send it to me via Twitter, and I fixed it. This is also where I know from that the article is on Hacker News :D