changeset 2296:6529768a96a2

stronger types
author drewp@bigasterisk.com
date Tue, 30 May 2023 01:01:53 -0700
parents d18586476827
children 33d1f00de395
files light9/web/SyncedGraph.ts
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/SyncedGraph.ts	Tue May 30 01:01:40 2023 -0700
+++ b/light9/web/SyncedGraph.ts	Tue May 30 01:01:53 2023 -0700
@@ -365,10 +365,11 @@
     return this.nextNumberedResources(base, 1)[0];
   }
 
-  contextsWithPattern(s: any, p: any, o: any) {
+  contextsWithPattern(s: Quad_Subject | null, p: Quad_Predicate | null, o: Quad_Object | null): N3.NamedNode[] {
     this.autoDeps.askedFor(s, p, o, null);
-    const ctxs = [];
+    const ctxs: N3.NamedNode[] = [];
     for (let q of Array.from(this.graph.getQuads(s, p, o, null))) {
+      if (q.graph.termType != "NamedNode") throw `context was ${q.graph.id}`;
       ctxs.push(q.graph);
     }
     return unique(ctxs);