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:
parent
d26b264e8d
commit
01510ca63f
|
@ -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>};
|
||||||
|
|
Loading…
Reference in New Issue