This commit is contained in:
parent
fa8e0d25c6
commit
019647b04a
@ -83,7 +83,7 @@ export class Graph extends Element {
|
||||
.replace (/^\s+$/gmu, '');
|
||||
}
|
||||
|
||||
public add_node (constructor: ((n: Node) => void) | string): string {
|
||||
public add_node (constructor: string | ((n: Node) => void)): string {
|
||||
const node = new Node ('unnamed', this.full_name);
|
||||
|
||||
if (typeof constructor === 'string') {
|
||||
@ -96,7 +96,7 @@ export class Graph extends Element {
|
||||
return node.full_name;
|
||||
}
|
||||
|
||||
public add_graph (constructor: ((g: Graph) => void) | string): string {
|
||||
public add_graph (constructor: string | ((g: Graph) => void)): string {
|
||||
const graph = new Graph ('unnamed', this.full_name);
|
||||
|
||||
graph.directional = this.directional;
|
||||
|
@ -168,7 +168,7 @@ export class GraphStream extends Transform {
|
||||
// this.write ({ type: 'en', args: [] });
|
||||
}
|
||||
|
||||
public create_graph (name: string, type: 'u'|'d'|'s' = 's'): void {
|
||||
public create_graph (name: string, type: 'd' | 's' | 'u' = 's'): void {
|
||||
const instr_type = `c${type}g` as GraphStreamCommand;
|
||||
this.write ({ type: instr_type, args: [ validate_name (name) ] });
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ const complex = `digraph foo {
|
||||
|
||||
// eslint-disable-next-line max-lines-per-function
|
||||
describe ('stream', () => {
|
||||
it ('stream graph', () => new Promise ((resolve) => {
|
||||
it ('stream graph', () => new Promise<void> ((resolve) => {
|
||||
let output = '';
|
||||
const stream = (new GraphStream);
|
||||
stream.on ('data', (data) => {
|
||||
@ -60,7 +60,7 @@ describe ('stream', () => {
|
||||
}));
|
||||
|
||||
// eslint-disable-next-line max-statements
|
||||
it ('complex stream graph', () => new Promise ((resolve) => {
|
||||
it ('complex stream graph', () => new Promise<void> ((resolve) => {
|
||||
let output = '';
|
||||
const stream = (new GraphStream);
|
||||
stream.on ('data', (data) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user