From be5d2d30bdd98dfc32c28a84ad606eb2b4599932 Mon Sep 17 00:00:00 2001
From: Tyler Schicke <tyler_schicke@brown.edu>
Date: Fri, 19 Apr 2019 02:40:46 -0400
Subject: Kind of got list typing working for schemas

---
 src/debug/Test.tsx | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'src/debug/Test.tsx')

diff --git a/src/debug/Test.tsx b/src/debug/Test.tsx
index b46eb4477..033615be6 100644
--- a/src/debug/Test.tsx
+++ b/src/debug/Test.tsx
@@ -1,7 +1,7 @@
 import * as React from 'react';
 import * as ReactDOM from 'react-dom';
 import { serialize, deserialize, map } from 'serializr';
-import { URLField, Doc, createSchema, makeInterface, makeStrictInterface } from '../fields/NewDoc';
+import { URLField, Doc, createSchema, makeInterface, makeStrictInterface, List, ListSpec } from '../fields/NewDoc';
 import { SerializationHelper } from '../client/util/SerializationHelper';
 
 const schema1 = createSchema({
@@ -18,7 +18,7 @@ type TestDoc = makeInterface<typeof schema1>;
 const schema2 = createSchema({
     hello: URLField,
     test: "boolean",
-    fields: "string",
+    fields: { List: "number" } as ListSpec<number>,
     url: "number",
     testDoc: URLField
 });
@@ -26,6 +26,13 @@ const schema2 = createSchema({
 const Test2Doc = makeStrictInterface(schema2);
 type Test2Doc = makeStrictInterface<typeof schema2>;
 
+const schema3 = createSchema({
+    test: "boolean",
+});
+
+const Test3Doc = makeStrictInterface(schema3);
+type Test3Doc = makeStrictInterface<typeof schema3>;
+
 const assert = (bool: boolean) => {
     if (!bool) throw new Error();
 };
@@ -53,7 +60,7 @@ class Test extends React.Component {
         assert(test1.myField === 20);
 
         assert(test2.hello === undefined);
-        assert(test2.fields === "test");
+        // assert(test2.fields === "test");
         assert(test2.test === undefined);
         assert(test2.url === undefined);
         assert(test2.testDoc === undefined);
-- 
cgit v1.2.3-70-g09d2

