summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-05-14 01:19:23 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-05-14 01:19:23 -0400
commitbfb3cd7a5c55dbf59eacb7d93e88f38632e47260 (patch)
tree65fdee9c91c262c3ea28eefbd39c8ae257a8e76f
parentbe7828684b888a8c9743e6dd7c54c924c076c8e2 (diff)
use tsc for type checking
-rw-r--r--Makefile1
-rw-r--r--main.ts5
-rw-r--r--v8worker2.d.ts6
3 files changed, 9 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 5cd8b9c15..6ccc4781d 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ msg.pb.d.ts: msg.pb.js node_modules
./node_modules/.bin/pbts -o msg.pb.d.ts msg.pb.js
dist/main.js: main.ts msg.pb.js msg.pb.d.ts node_modules
+ ./node_modules/.bin/tsc --noEmit # Only for type checking.
./node_modules/.bin/parcel build --out-dir=dist/ --no-minify main.ts
node_modules:
diff --git a/main.ts b/main.ts
index 9071c2fcd..44519489a 100644
--- a/main.ts
+++ b/main.ts
@@ -1,9 +1,8 @@
-import * as ts from "typescript";
+//import * as ts from "typescript";
import { main as pb } from "./msg.pb"
-V8Worker2.recv((ab: ArrayBuffer) {
+V8Worker2.recv((ab: ArrayBuffer) => {
let msg = pb.Msg.decode(new Uint8Array(ab));
- V8Worker2.print("Got array buffer", ab.byteLength);
V8Worker2.print("msg.argv", msg.argv);
});
diff --git a/v8worker2.d.ts b/v8worker2.d.ts
new file mode 100644
index 000000000..9ace56ff7
--- /dev/null
+++ b/v8worker2.d.ts
@@ -0,0 +1,6 @@
+declare namespace V8Worker2 {
+ function print(...args: any[]): void;
+ type RecvCallback = (ab: ArrayBuffer) => void;
+ function recv(cb: RecvCallback): void;
+ function send(ab: ArrayBuffer): null | ArrayBuffer;
+}