Fix up a bunch of typescript issues

These came to light with the typescript compiler upgrade that is
coming up soon with the bazel upgrade.

A lot of the changes in this patch arose from the changes in the
imports. For some reason we can no longer import modules the way we
used to. I'm not really sure how it ever worked. The upstream
documentation agrees with the changes we had to make here. It's
possible that the old version of typescript simply did things
differently when it comes to importing modules.

Change-Id: I054b5269c90cc94276e9f856d8cd79c8de2946f2
diff --git a/aos/network/www/reflection.ts b/aos/network/www/reflection.ts
index a2fe3e4..9c21a17 100644
--- a/aos/network/www/reflection.ts
+++ b/aos/network/www/reflection.ts
@@ -6,7 +6,8 @@
 // constructed flatbuffers.
 // See reflection_test_main.ts for sample usage.
 
-import {reflection, aos} from 'aos/configuration_generated';
+import {reflection, aos} from 'org_frc971/aos/configuration_generated';
+import {ByteBuffer} from 'org_frc971/external/com_github_google_flatbuffers/ts/byte-buffer';
 
 // Returns the size, in bytes, of the given type. For vectors/strings/etc.
 // returns the size of the offset.
@@ -100,10 +101,6 @@
   return isInteger(baseType) && (typeSize(baseType) > 4);
 }
 
-// TODO(james): Use the actual flatbuffers.ByteBuffer object; this is just
-// to prevent the typescript compiler from complaining.
-class ByteBuffer {}
-
 // Stores the data associated with a Table within a given buffer.
 export class Table {
   // Wrapper to represent an object (Table or Struct) within a ByteBuffer.
@@ -217,7 +214,7 @@
   }
 
   // Returns the Object definition associated with the given type index.
-  getType(typeIndex: number): Object {
+  getType(typeIndex: number): reflection.Object {
     if (typeIndex === -1) {
       return this.schema.rootTable();
     }
@@ -230,7 +227,7 @@
   // Retrieves the Field schema for the given field name within a given
   // type index.
   getField(fieldName: string, typeIndex: number): reflection.Field {
-    const schema: Object = this.getType(typeIndex);
+    const schema: reflection.Object = this.getType(typeIndex);
     const numFields = schema.fieldsLength();
     for (let ii = 0; ii < numFields; ++ii) {
       const field = schema.fields(ii);
@@ -300,7 +297,7 @@
     if (offsetToOffset === table.offset) {
       return null;
     }
-    return table.bb.__string(offsetToOffset);
+    return table.bb.__string(offsetToOffset) as string;
   }
   // Reads a sub-message from the given Table. The sub-message may either be
   // a struct or a Table. Returns null if the sub-message is not set.