Commit 3e7a7de
committed
fix: weaken internal group types to strengthen return/onCancel types
This changes a few things.
First of all, trying to infer `T` while defining `T` currently doesn't
work unless there's a member without the `results` arg. This is a known
limitation that may or may not be fixed in typescript one day.
Until that happens, if ever, this dumbs down the type of `results` to be
a `Record<PropertyKey, unknown>`. This means _within a function_ you
lose strong typing, but the return type will now always be correct.
Secondly, `T` is actually the resulting already-awaited shape. This
means we do not need `Awaited<T[K]>` since `T[K]` is already the awaited
type.
For example:
```ts
type ActualType = {
foo: number;
bar: number;
};
group<ActualType>({
foo: () => Promise.resolve(303),
bar: () => Promise.resolve(808)
});
```
You can see the `ActualType` never needed `Awaited<T>` on each type
since it is already the final result.1 parent 5529c89 commit 3e7a7de
1 file changed
+3
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
844 | 844 | | |
845 | 845 | | |
846 | 846 | | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | 847 | | |
852 | 848 | | |
853 | 849 | | |
854 | 850 | | |
855 | 851 | | |
856 | | - | |
| 852 | + | |
857 | 853 | | |
858 | 854 | | |
859 | 855 | | |
| |||
862 | 858 | | |
863 | 859 | | |
864 | 860 | | |
865 | | - | |
| 861 | + | |
866 | 862 | | |
867 | 863 | | |
868 | 864 | | |
| |||
873 | 869 | | |
874 | 870 | | |
875 | 871 | | |
876 | | - | |
| 872 | + | |
877 | 873 | | |
878 | 874 | | |
879 | 875 | | |
| |||
0 commit comments