Make node and edge types exact (#51)

Summary:
We’ve realized that `u: Edge<T>` implies `u: Node<T>`. 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
This commit is contained in:
William Chargin 2018-03-02 11:31:38 -08:00 committed by GitHub
parent d26b264e8d
commit 01510ca63f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -6,17 +6,17 @@ export type Address = {
id: string, id: string,
}; };
export type Node<T> = { export type Node<T> = {|
address: Address, address: Address,
payload: T, payload: T,
}; |};
export type Edge<T> = { export type Edge<T> = {|
address: Address, address: Address,
src: Address, src: Address,
dst: Address, dst: Address,
payload: T, payload: T,
}; |};
export class Graph { export class Graph {
_nodes: {[nodeAddress: string]: Node<mixed>}; _nodes: {[nodeAddress: string]: Node<mixed>};