Skip to content

Commit 14ed7a8

Browse files
committed
allow cancel event predicates to return any Thenable type
1 parent 5d2ab89 commit 14ed7a8

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/types/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ For prereleases:
3535
- `defineSetupHook` for defining a context setup hook.
3636
- Note that these are meant to be used standalone, so you can get type hints if you want to reuse these components across actions. If you're already defining an action via `defineAction` and don't need to reuse those components across actions, you shouldn't need to use these helper functions (and is discouraged since it can overcomplicate type checking).
3737

38+
### Changed
39+
40+
- Cancel event predicates are now typed as `(event: T) => boolean | Thenable<boolean>`, which no longer restricts you to using `Promise`s.
41+
3842
## 1.0.0-pre.14
3943

4044
### Breaking changes

packages/types/src/actions/classes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export interface RCECancelEventInitializer<T = any> {
131131
/** The reason that will be used to log the cancellation. */
132132
logReason?: ReasonGenerator<T>;
133133
/** Events that will trigger the cancellation. If the predicate is null, the event will always trigger the cancellation. */
134-
events?: [Event<T>, ((data: T) => boolean | Promise<boolean>) | null][];
134+
events?: [Event<T>, ((data: T) => boolean | Thenable<boolean>) | null][];
135135
}
136136

137137
export interface RCECancelEvent<T = any> {

0 commit comments

Comments
 (0)