-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic Constraints working incorrectly #29000
Comments
EDIT: Outdated comment. I wont delete the comment so you can read the history if you want. |
No problem. If I were you I would edit your initial post with the new example (and I'll probably remove / edit my comment too). This looks familiar to other posts I've seen but I can't say if this is a duplicate. Your This seems to boil down to whether Sorry I can't be more help! |
@jack-williams Thanks. And I found a issue here which is similar: #28748 So maybe my issue is duplicated? |
Possibly; this issue also looks similar #28821. I don't know enough to say if this is a duplicate so I would wait for someone more knowledgeable to drop by. |
Potentially a dupe; I'll let @ahejlsberg decide. |
Also similar to #28884. |
Duplicate of #28884. |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
TypeScript Version: 3.2.2
Code
Expected behavior:
shouldn't have any type error
Actual behavior:
has a error:
Playground Link:
https://www.typescriptlang.org/play/index.html#src=type%20Omit%3CT%2C%20K%20extends%20keyof%20T%3E%20%3D%20Pick%3CT%2C%20Exclude%3Ckeyof%20T%2C%20K%3E%3E%3B%0A%0Ainterface%20IName%20%7B%0A%20%20name%3A%20string%3B%0A%7D%0A%0Aconst%20callWithName%20%3D%0A%20%20%3CT%20extends%20IName%2C%20R%3E(fn%3A%20(origianlArgs%3A%20T)%20%3D%3E%20R%2C%20name%3A%20string)%20%3D%3E%0A%20%20%20%20(arg%3A%20Omit%3CT%2C%20'name'%3E)%20%3D%3E%0A%20%20%20%20%20%20fn(%7B%0A%20%20%20%20%20%20%20%20...arg%2C%0A%20%20%20%20%20%20%20%20name%2C%0A%20%20%20%20%20%20%7D)%3B%0A%0Aconst%20greeting%20%3D%20(arg%3A%20%7B%20name%3A%20string%20%7D)%20%3D%3E%20%7B%0A%20%20console.log(%60Hello%20%24%7Barg.name%7D%60)%3B%0A%7D%0A%0Aconst%20greetingToTom%20%3D%20callWithName(greeting%2C%20'Tom')%3B%0A%0AgreetingToTom(%7B%7D)%3B
Related Issues:
The text was updated successfully, but these errors were encountered: