-
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
Intellisense breaks when omit is used #32289
Labels
Needs Investigation
This issue needs a team member to investigate its status.
Milestone
Comments
RyanCavanaugh
added
the
Needs Investigation
This issue needs a team member to investigate its status.
label
Jul 8, 2019
I've narrowed down the root cause of this being this definition in the export type SelectComponentsProps = { [key in string]: any }; // <-- this
export interface Props<OptionType = { label: string; value: string }> extends SelectComponentsProps { Is it expected behavior in this case, and if not, can you think of a workaround? |
Managed to find a workaround by inferring the actual keys with this: type KnownKeys<T> = { [K in keyof T]: string extends K ? never : number extends K ? never : K } extends { [_ in keyof T]: infer U } ? U : never;
export type SelectProps<T> = Pick<ReactSelectProps<T>, KnownKeys<ReactSelectProps<T>>>; |
More of an explanation here for those looking https://stackoverflow.com/questions/60636985/why-i-cant-use-omit-on-asyncprops-of-react-select |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've encountered some issues when using Omit to filter prop types for react components. I was not able to replicate it on the typescript playground, so it appears to only happen for more complex types? I was able to reproduce it when trying to omit certain props from the default props of react-select.
TypeScript Version: Have replicated on 3.3.3, 3.4.5, 3.5.2 and 3.6.0-dev.20190704
Search Terms:
omit intellisense
Code
Reproduction repository can be found here https://github.com/mvestergaard/typescript-omit-repro
Expected behavior:
Intellisense should show available properties when Omit is used
Actual behavior:
It doesn't show any properties
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: