core
core copied to clipboard
Type translation of delegate types
Part of #820
In WebSharper 4.0, delegates translate to JS funcions, with a few extra fields: $Func for the non-bound version, and $Target for the target object. Multi-cast delegates have an $Invokes which holds the invocation list as an array. All of these are treated as optional, so that any JS function works against WS-generated code that takes delegates.
Simply translating delegate types to their function signatures should be viable for a first-pass solution. So for example Action<int> becomes number => void. And then later it is possible to switch to generate named interfaces for them, like
interface Action<T0> extends WebSharper.MulticastDelegate {
(a:T0): void;
}
- [x] Translated to lambda type
- [ ] Translated to named type
Now translated to plain lambda signatures