From 2aa31db3b69e38e27c4cf19c66f5fcaea73fb92a Mon Sep 17 00:00:00 2001 From: Daniele Coppolino Date: Tue, 24 Jul 2018 18:19:29 +0200 Subject: [PATCH] Make node and edge interfaces inherit from their options (#27254) Node and Edge interfaces should inherit from NodeOptions and EdgeOptions. These Options are meant to be global, so properties such as "id", "from" and "to" should exist only on Node and Edge interfaces. Plus, in this way it's possible to use all properties defined on parent interface. --- types/vis/index.d.ts | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/types/vis/index.d.ts b/types/vis/index.d.ts index caa0ab945a..5fffcb6e7a 100644 --- a/types/vis/index.d.ts +++ b/types/vis/index.d.ts @@ -9,6 +9,7 @@ // Adam Lewis // Alex Soh // Oleksii Kachura +// dcop // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { MomentInput, MomentFormatSpecification, Moment } from 'moment'; @@ -1685,19 +1686,11 @@ export interface Data { edges?: Edge[] | DataSet; } -export interface Node { - group?: string; +export interface Node extends NodeOptions { id?: IdType; - label?: string; - x?: number; - y?: number; - fixed?: boolean; - image?: string | Image; - shape?: string; - color?: string | Color; } -export interface Edge { +export interface Edge extends EdgeOptions { from?: IdType; to?: IdType; id?: IdType; @@ -1823,8 +1816,6 @@ export interface NodeOptions { color?: string, }; - id?: string; - image?: string | Image; label?: string; @@ -1906,14 +1897,10 @@ export interface EdgeOptions { mono?: string | FontOptions, }; - from?: number | string; - hidden?: boolean; hoverWidth?: number; // please note, hoverWidth could be also a function. This case is not represented here - id?: string; - label?: string; labelHighlightBold?: boolean; @@ -1939,8 +1926,6 @@ export interface EdgeOptions { title?: string; - to?: number | string; - value?: number; width?: number;