3 ms·
If you read the blog post you'd see it's not a "TypeScript can't even type Object.Keys" situation but instead a "it is incorrect to assign it the type you want
by kevingadd 3y ago
If you read the blog post you'd see it's not a "TypeScript can't even type Object.Keys" situation but instead a "it is incorrect to assign it the type you want because of how JavaScript works"
- ashishb 3y agoI did read the blog post. The underlying issue might be in JavaScript. But that's an implementation detail. Here's my question to you why is this problem non-existent in c++/Java/go/rust?
- bazoom42 3y agoThose languages all have the same issue since it is a logical consequence of having subtypes. You probaly just don’t realize it becase doing anything similar to the example would require convoluted reflection.