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
type Deferred<T> = {
[P in keyof T]: Promise<T[P]>;
};
And we have:
interface Obj
{
id: number;
employee: {
id: number;
name: string;
}
// an array here too
}
With Deferred<Obj> the employee object and arrays will also be Promise but that would not always be what we want. It also will not nest on children objects.
The ability to filter keys by type would be very good as:
type Container<T> = {
[P in keyof T where T[P] extends number | string]: Promise<T[P]>;
[P in keyof T where T[P] extends {}]: Container<T[P]>;
}
If use more than one in would be out of question, something using intersection may work too.
The text was updated successfully, but these errors were encountered:
I understand the similarity and depending on the design of #12424 it will cover my needs. On the other hand, this issue may do additional things, i.e., really "filter" out (hide) what comes from in/keyof depending on a condition.
So there is:
And we have:
With
Deferred<Obj>
theemployee
object and arrays will also bePromise
but that would not always be what we want. It also will not nest on children objects.The ability to filter keys by type would be very good as:
If use more than one
in
would be out of question, something using intersection may work too.The text was updated successfully, but these errors were encountered: