emberjs / emberjs/ember-test-waiters
Runloop compatible `waitFor` type
- Dominant language
- TypeScript
- Stars
- 31
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
Is it feasible to provide a type for `waitFor` that is compatible with Ember's runloop functions?
Looking to do something like:
```ts
schedule('afterRender', waitFor(async () => { … }))
```
However this currently throws a type error:
```
Argument of type 'Function' is not assignable to parameter of type 'AnyFn'.
Type 'Function' provides no match for the signature '(...args: any[]): unknown'. ts(2345)
```
Adding this function override appears to minimally be enough to clear up the issue:
```ts
export default function waitFor(fn: AsyncFunction, label?: string): (...args: any[]) => unknown;
```
A possibly more robust solution:
```ts
export default function waitFor(fn: AsyncFunction, label?: string): (...args: unknown[]) => unknown;
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.