We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
TypeScript Version: 2.1.5
Code
Taken from 'Using Type Parameters in Generic Constraints' in the official docs
function copyFields<T extends U, U>(target: T, source: U): T { for (let id in source) { target[id] = source[id]; } return target; } let x = { a: 1, b: 2, c: 3, d: 4 }; copyFields(x, { b: 10, d: 20 });
Expected behavior:
Compiles.
Actual behavior:
error TS2322: Type 'U[keyof U]' is not assignable to type 'T[keyof U]'. Type 'U' is not assignable to type 'T'.
The text was updated successfully, but these errors were encountered:
I raised the documentation issue in #13023
Sorry, something went wrong.
Fix microsoft/TypeScript#13651: update generic extends example
582870a
No branches or pull requests
TypeScript Version: 2.1.5
Code
Taken from 'Using Type Parameters in Generic Constraints' in the official docs
Expected behavior:
Compiles.
Actual behavior:
The text was updated successfully, but these errors were encountered: