use tsc for type checking

This commit is contained in:
Ryan Dahl 2018-05-14 01:19:23 -04:00
parent be7828684b
commit bfb3cd7a5c
3 changed files with 9 additions and 3 deletions

View File

@ -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:

View File

@ -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);
});

6
v8worker2.d.ts vendored Normal file
View File

@ -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;
}