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
Error in Diff / Omit types #21148
Comments
Briefly, this error is correct. The second half of declare function f<T,K extends keyof T>(sub: ({ [P in K]: never })[keyof T]): void; Consider The question is how to make these libraries work again. |
Fix is up at #21156 |
@sandersn I believe that the part of |
@DanielRosenwasser also pointed out that taken as a whole, In any case, my initial diagnosis is wrong. The reason these types fail is that the constraint of The fix in #21156 avoids this transform, so the constraint is |
The types in EuiContextMenu caused errors that seemed to result from usage of the `Omit<>` helper. It might be fixed with microsoft/TypeScript#21148, which is expected to be included in 2.7.1.
Has this been released already because Omit doesn't seem to work in 2.7.2 with optional properties. I have a base interface that comes from a library, which defines lots of optional component properties and my component is expected to allow defining all those properties except a couple. I was trying to use the oh so popular implementation of Omit but it seems to be completely ignoring optional types. Consider this scenario: type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
export interface DropdownProps {
optional1?: string;
optional2?: string;
optional3?: string;
}
export interface MyComponentProps extends Omit<DropdownProps, 'optional2'> {
custom1?: string;
} Then when I use my component that implements the interface as follows -
|
TypeScript Version: 2.7.0-dev.20180111
Code
Expected behavior:
No error.
Actual behavior:
These types were taken from #12215 (comment) so are present in a few DefinitelyTyped packages.
There was no error in
typescript@2.7.0-dev.20180110
. Error discovered inrecompose
(among others) on DefinitelyTyped.The text was updated successfully, but these errors were encountered: