Hacker News new | ask | show | jobs
by afavour 1608 days ago
All of that is possible with a string literal union though, surely?
1 comments

It's not possible to get the autocomplete unless the function/method you're calling takes a union. Many libraries can't do that because they need to be flexible in what they receive. So yeah, you can define a union, but editors don't have the context to know your union applies to the call.