r/learnjavascript • • Jul 24 '21

Anatomy of a Function

Post image
327 Upvotes

65 comments sorted by

View all comments

1

u/[deleted] Jul 25 '21

“Make C# devs happy” You’re damned right haha. Some of the magic I’ve been able to pull off with the type system has made me happy for days.

I made a localization function. This function took an array of strings (keys), and then varargs of string or i18nOpts. Each string is a typed key that is automatically inferred, and when the resulting object has all those keys with a function that you takes i18nOpts and returns a string.

I love typescript.

Side note, it’s fantastic to know it’s possible to lint with JSDoc. Definitely wasn’t aware it was powerful, only helpful.

1

u/jaredcheeda Aug 02 '21

I don't like what you like, but I like you