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.
This commit is contained in:
Daniele Coppolino
2018-07-24 18:19:29 +02:00
committed by Andy
parent e859a48538
commit 2aa31db3b6

21
types/vis/index.d.ts vendored
View File

@@ -9,6 +9,7 @@
// Adam Lewis <https://github.com/supercargo>
// Alex Soh <https://github.com/takato1314>
// Oleksii Kachura <https://github.com/alex-kachura>
// dcop <https://github.com/dcop>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { MomentInput, MomentFormatSpecification, Moment } from 'moment';
@@ -1685,19 +1686,11 @@ export interface Data {
edges?: Edge[] | DataSet<Edge>;
}
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;