Hello, I am trying to use a function that determines the type of an object's property "payload" based on an argument passed to it. I've attempted to constrain a generic type to a union of string literals but Typescript isn't happy about it. Certainly I'm missing something big here. Would appreciate help if anyone has time! Thanks ❤️ https://www.typescriptlang.org/play?#code/C4TwDgpgBAggxsAlgewHYGcoF4oG8qiQBcUA5GAE6JwSkA0UYAhiADbJMAmJqArgLYAjCBSgBfKAB8oAKHyEIJUgEdeTVElD1GLdlx4DhoidLkFwispybBaDZmw7co6YFVQBzcVADcMmXBorlC8YNa2AGKIEKyc2FAAPAAqUBAAHraonJjkVDSkUmSq6pogBdKk4bQAfDIAFAokSfa6Tk2pGRBZOVUFAPwuboieUAZCIgCU2NV4MlDzUIEYwFBMCCgYRPBIQfG4cwvzDnqcdAeHCmeHYn7zYkA
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.