Commits
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.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: jacobparis <jacobparis@users.noreply.github.com>
Co-authored-by: Nate Moore <nate@natemoo.re>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
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.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>