From 7da4f8add9fcb58c320ef8a5a71305a0e78c8eae Mon Sep 17 00:00:00 2001 From: Revone Date: Sun, 26 Nov 2023 20:13:34 +0800 Subject: [PATCH] fix: In Graph data structures, only use 'undefined' and abandon the design where both 'null' and 'undefined' coexist. --- test/unit/data-structures/graph/abstract-graph.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unit/data-structures/graph/abstract-graph.test.ts b/test/unit/data-structures/graph/abstract-graph.test.ts index 54b0ac0..dd2387b 100644 --- a/test/unit/data-structures/graph/abstract-graph.test.ts +++ b/test/unit/data-structures/graph/abstract-graph.test.ts @@ -36,11 +36,11 @@ class MyGraph< return new MyEdge(srcOrV1, destOrV2, weight, value) as EO; } - deleteEdge(edge: EO): EO | null { + deleteEdge(edge: EO): EO | undefined { return edge; } - getEdge(srcOrKey: VertexKey, destOrKey: VertexKey): EO | null { + getEdge(srcOrKey: VertexKey, destOrKey: VertexKey): EO | undefined { return new MyEdge(srcOrKey, destOrKey) as EO; } @@ -62,8 +62,8 @@ class MyGraph< return [new MyVertex(a, 'b') as VO]; } - getEndsOfEdge(edge: EO): [VO, VO] | null { - return edge ? null : null; + getEndsOfEdge(edge: EO): [VO, VO] | undefined { + return edge ? undefined : undefined; } protected _addEdgeOnly(edge: EO): boolean {