We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This type can be usefull to reverse required and optional properties of an object. Related question: https://stackoverflow.com/questions/57593022/reverse-required-and-optional-properties.
Solution:
import { RequiredKeys, OptionalKeys } from 'utility-types'; export declare type Flip<T> = Partial<Pick<T, RequiredKeys<T>>> & Required<Pick<T, OptionalKeys<T>>>;
Usage:
import { Flip } from 'utility-types'; type MyObject = { a: number b?: number c?: number }; type MyFlippedObject = Flip<MyObject>; // Should be // type MyObject = { // a?: number // b: number // c: number // };
TypeScript users.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is your feature request related to a real problem or use-case?
This type can be usefull to reverse required and optional properties of an object.
Related question: https://stackoverflow.com/questions/57593022/reverse-required-and-optional-properties.
Describe a solution including usage in code example
Solution:
Usage:
Who does this impact? Who is this for?
TypeScript users.
The text was updated successfully, but these errors were encountered: