4
lorentz
3y

I love Typescript's challenges. Today I had to make a generic interface that replaces every property in its parameter with either itself, a promise of itself or a different property keyed `obtain${key}` which is a function returning either the value or a promise of it. Not a very difficult challenge, but it was very satisfying to solve.
If anyone has the patience to attempt it I'm very curious what more experienced type theorists than myself come up with.

Comments
  • 0
    It feels satisfying. This is a puzzle that you could nuke with "any" or of sorts, but you know it's going to create chaos. Types act like guardians, and studying them pays off.
Add Comment