This repository was archived by the owner on Apr 17, 2022. It is now read-only.
This repository was archived by the owner on Apr 17, 2022. It is now read-only.
Use types for layout.force[...]() #6
Closed
Description
I had a look to the TODO's to support more typed functions, e.g. to created a custom typed layout.Force.
You may encounter issues with mutable typed classes, which you can't make co-variant, such as e.g. Link[Node].
The following approach may help:
@js.native
trait AbstractLink extends js.Object {
type Node <: forceModule.Node
var source: Node
var target: Node
}
@js.native
trait Link[T <: forceModule.Node] extends forceModule.AbstractLink {
type Node = T
}
@js.native
trait Force[Link <: forceModule.AbstractLink, Node <: forceModule.Node] extends js.Object