You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is this request related to a problem? Please describe.
In Typescript there's a way to declare a type as a subset of another types properties, using Pick and Omit. Pick explicitly includes the properties of the source type while Omit excludes them and includes the others that were not specified.
typeMyType={a: number;b: number;c: number;}// the refactoring would convert between those two representations:typeOnlyAB1=Pick<MyType,"a"|"b">;typeOnlyAB2=Omit<MyType,"c">;
Sometimes over time it turns out that a type definition using Pick would be better written using Omit, or the other way around.
Describe the solution you'd like
I'd like to have a refactoring that works on the TS level which converts one declaration to the other. E.g. if a type is declared using Pick and I execute the new Convert to Omit<> refactoring, it would analyze the source type, find out which properties were implicitly excluded using the previous Pick notation and make that explicit with the Omit notation.
The text was updated successfully, but these errors were encountered:
I think we still struggle to determine types that are imported (at least, we can't do that in Action Providers, too heavy). But it would work just fine for a locally defined type I think.
Is this request related to a problem? Please describe.
In Typescript there's a way to declare a type as a subset of another types properties, using
Pick
andOmit
.Pick
explicitly includes the properties of the source type whileOmit
excludes them and includes the others that were not specified.Sometimes over time it turns out that a type definition using
Pick
would be better written usingOmit
, or the other way around.Describe the solution you'd like
I'd like to have a refactoring that works on the TS level which converts one declaration to the other. E.g. if a type is declared using
Pick
and I execute the new Convert to Omit<> refactoring, it would analyze the source type, find out which properties were implicitly excluded using the previousPick
notation and make that explicit with theOmit
notation.The text was updated successfully, but these errors were encountered: