Description
The CLIEvent property seems to be missing from object expressions.
Repro code
open System
type InterfaceWithCLIEvent<'t> =
[<CLIEvent>]
abstract Event : IEvent<System.Action<obj,'t>,'t>
let event = Event<Action<obj, bool>,bool>()
let ifaceWIthEvent =
{ new InterfaceWithCLIEvent<_> with
[<CLIEvent>]
member __.Event = event.Publish }
Expected and actual results
In JavaScript this compiles to:
import Event$ from "fable-library/Event.js";
export const event = new Event$();
export const ifaceWIthEvent = {
add_Event(handler) {
event.Publish.AddHandler(handler);
},
remove_Event(handler_1) {
event.Publish.RemoveHandler(handler_1);
},
};
So the Event property is gone. I came across this issue since Python uses interfaces and I get the error: Can't instantiate abstract class ObjectExpr0 with abstract method Event
Interface looks like this:
class InterfaceWithCLIEvent_1(Protocol, Generic[_T]):
@abstractmethod
def add_event(self, __arg0: Any) -> None:
...
@property
@abstractmethod
def Event(self) -> IEvent_2[Any, _T]:
...
@abstractmethod
def remove_event(self, __arg0: Any) -> None:
...
So the Event is part of the interface, but not part of the implementation. If you implement a class using the interface, then the property will be available.
Related information
- Fable version: repl4
- Operating system
Description
The CLIEvent property seems to be missing from object expressions.
Repro code
Expected and actual results
In JavaScript this compiles to:
So the
Eventproperty is gone. I came across this issue since Python uses interfaces and I get the error:Can't instantiate abstract class ObjectExpr0 with abstract method EventInterface looks like this:
So the
Eventis part of the interface, but not part of the implementation. If you implement a class using the interface, then the property will be available.Related information