-
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
Exclude doesn't work with extended generics #24791
Comments
I get a similar issue with
ERROR:
If I allow TS to infer the type of This worked fine in TS2.8, but the algorithm for comprehending This issue can be circumvented by using
instead, but my worry is that based on the stated new I understand that there might be a later class S that extends R and includes keys that are numbers|symbols, and could be used for ... Perhaps I am missing something ... When I put in these Thanks |
I've run into a similar case on
|
My understanding of This may be the correct way to write it, but is still runs into the
|
I have a related case that worked perfectly in typescript 3.1 (or at least wasn't giving errors), and stopped working from typescript 3.2 onwards (including latest 3.4 beta).
The error is that {...props, ...contextProps} is not assignable to InputProps, when it should be. |
@tanglebones You need to write your example like this: type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
function bindp<T extends P, P extends object, R>(
f: (arg: T) => R,
p: P
):
(q: Omit<T,keyof P>) => R {
return function (q: Omit<T,keyof P>): R {
const args: T = <T>{...q, ...p};
return f(args);
}
} |
TypeScript Version: 2.9.1, 3.0.0-dev.20180608
Search Terms:
keyof generics extend exclude
Code
Expected behavior:
Props in generator should have RequiredFields fields.
Actual behavior:
Props are empty.
Playground Link: Link
Related Issues:
#21941 #21862.
The issues are closed but the bug is still here
The text was updated successfully, but these errors were encountered: