`delay` doesn't allow to use `void` in `target`
The effect in the target expects void, a conditional number arrives from doneData - a mismatch in delay types
example:
delay({
source: someFirstFx.doneData,
timeout: 1000,
target: someSecondFx,
});
Could you add a reproduce in https://www.typescriptlang.org/play ?
@sergeysova check this
the second effect takes data from the store via attach
maybe in delay we need to be able to choose between source/clock?
Okay, I transformed your example into minimal reproduce:
import { delay } from 'patronum';
import { createEvent } from 'effector';
const input = createEvent<string>()
const output = createEvent<void>();
delay({
source: input,
timeout: 1000,
target: output,
});
Type 'Event<void>' is not assignable to type 'Event<string> | Store<string> | Effect<string, any, any> | undefined'.
Type 'Event<void>' is not assignable to type 'Event<string>'.
Types of property 'watch' are incompatible.
Type '(watcher: (payload: void) => any) => Subscription' is not assignable to type '(watcher: (payload: string) => any) => Subscription'.
Types of parameters 'watcher' and 'watcher' are incompatible.
Types of parameters 'payload' and 'payload' are incompatible.
Type 'void' is not assignable to type 'string'.(2322)
index.d.ts(6, 5): The expected type comes from property 'target' which is declared here on type '{ source: Unit<string>; timeout: number | Store<number> | ((_payload: string) => number); target?: Event<string> | Store<string> | Effect<string, any, any> | undefined; }'
more complete example
You could solve it in userland. Something like this will work.
delay({
source: sample({
clock: input,
fn: () => {},
}),
timeout: 1000,
target: output,
});