Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions types/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,21 @@ function* mySaga(): Effects.SagaGenerator<void> {
yield* Effects.spawn([obj, "outer"], emitter, handler);
yield* Effects.spawn({ context: obj, fn: obj.outer }, emitter, handler);
yield* Effects.spawn({ context: obj, fn: "outer" }, emitter, handler);

// eslint-disable-next-line @typescript-eslint/no-unused-vars
function handleArgumentThatIsPartOfUnion(requestId: 27 | 28) {
return 22;
}
// $ExpectType number
yield* Effects.call(handleArgumentThatIsPartOfUnion, 27);

type FetchOptions = {
readonly method?: "GET" | "POST";
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function* ourFetch(options: FetchOptions) {}
// Fails in 1.5 as argument is widened to string it seems (works in 1.4)
yield* Effects.call(ourFetch, { method: "POST" });
// Works (in 1.5 and 1.4, but this workaround is not possible for the numeric case above)
yield* Effects.call(ourFetch, { method: "POST" as const });
}