From 01510ca63f511335b4125bb5d1f414bcc3a9687d Mon Sep 17 00:00:00 2001 From: William Chargin Date: Fri, 2 Mar 2018 11:31:38 -0800 Subject: [PATCH] Make node and edge types exact (#51) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: We’ve realized that `u: Edge` implies `u: Node`. That certainly wasn’t what we were expecting! We might want something like that eventually, to capture the fact that valuations are themselves valuable, but for now the type system should encode the assumptions that we’re actually making. See also #50. Paired with @dandelionmane. wchargin-branch: exact-types --- src/backend/graph.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/graph.js b/src/backend/graph.js index e07e6a5..e31e803 100644 --- a/src/backend/graph.js +++ b/src/backend/graph.js @@ -6,17 +6,17 @@ export type Address = { id: string, }; -export type Node = { +export type Node = {| address: Address, payload: T, -}; +|}; -export type Edge = { +export type Edge = {| address: Address, src: Address, dst: Address, payload: T, -}; +|}; export class Graph { _nodes: {[nodeAddress: string]: Node};