Closed as not planned
Description
π Search Terms
Function addition attribute
π Version & Regression Information
No solution is provided in typescript
β― Playground Link
No response
π» Code
interface ReactiveEffectRunner<T = any> {
(): T;
effect: ReactiveEffect;
}
const runner = _effect.run.bind(_effect) as ReactiveEffectRunner;
runner.effect = _effect;
π Actual behavior
const runner:ReactiveEffectRunner = _effect.run.bind(_effect);
When we use type annotations this way, we get an error: type "() => Missing attribute "effect" in any" but type "ReactiveEffectRunner< any>" This property is required in.
π Expected behavior
How do we assign properties to a function if we don't use as to make assertionsοΌ
I needed typescript to provide a solution for us to solve the problem of incorrect function assignment types, instead of using crude assertions to solve it. Because typescript can put forward solutions to solve problems, it will make the code more elegant. Looking forward to your reply, thank you! π
### Tasks