Fixes types.

This commit is contained in:
Henning Dieterichs
2020-08-22 15:46:44 +02:00
parent 1dd0349483
commit 41747c5dd0
4 changed files with 14 additions and 17 deletions

View File

@@ -6,10 +6,7 @@ import {
DataExtraction,
ExtractionCollector,
} from "./DataExtractorApi";
import {
VisualizationData,
DataExtractorInfo,
} from "../../DataExtractionResult";
import { DataExtractorInfo } from "../../DataExtractionResult";
import { registerDefaultExtractors } from "./default-extractors";
/**

View File

@@ -1,10 +1,10 @@
import {
CommonDataTypes,
EdgeGraphData,
NodeGraphData,
GraphEdge,
GraphNode,
GraphVisualizationData,
} from "../../CommonDataTypes";
export type CreateGraphEdge<T> = { to: T } & Omit<EdgeGraphData, "from" | "to">;
export type CreateGraphEdge<T> = { to: T } & Omit<GraphEdge, "from" | "to">;
/**
* Given a list of roots, it creates a graph by following their edges recursively.
@@ -17,10 +17,10 @@ export function createGraph<T>(
) => {
id?: string | number;
edges: CreateGraphEdge<T>[];
} & Omit<NodeGraphData, "id">,
} & Omit<GraphNode, "id">,
options: { maxSize?: number } = {}
): CommonDataTypes.Graph {
const r: CommonDataTypes.Graph = {
): GraphVisualizationData {
const r: GraphVisualizationData = {
kind: {
graph: true,
},

View File

@@ -1,4 +1,4 @@
import { NodeGraphData, CommonDataTypes } from "../../CommonDataTypes";
import { GraphNode, GraphVisualizationData } from "../../CommonDataTypes";
import { CreateGraphEdge, createGraph } from "./createGraph";
/**
@@ -12,8 +12,8 @@ export function createGraphFromPointers<T>(
) => {
id?: string | number;
edges: CreateGraphEdge<T>[];
} & Omit<NodeGraphData, "id">
): CommonDataTypes.Graph {
} & Omit<GraphNode, "id">
): GraphVisualizationData {
const marker = {};
interface Pointer {

View File

@@ -1,11 +1,11 @@
import { CommonDataTypes } from "../../CommonDataTypes";
import { GridVisualizationData } from "../../CommonDataTypes";
export function markedGrid(
arr: any[],
marked: Record<string, number>
): CommonDataTypes.Grid {
): GridVisualizationData {
return {
kind: { array: true },
kind: { grid: true },
rows: [{ columns: arr.map(d => ({ tag: d })) }],
markers: Object.entries(marked).map(([key, val]) => ({
id: key,