The JavaScript and TypeScript source code uses msgpack-js for the MessagePack encoding.
JavaScript and TypeScript:
export const Pi = 3.141592;
JavaScript:
export const E = {
This: 1,
That: 2,
enc: Int.enc,
dec: Int.dec,
};
TypeScript:
export const E = Int;
// decl.d.ts
export declare const enum E {
This = 1,
That = 2,
}
JavaScript:
export const S = {
enc(buf, v) { ... },
dec(buf) { ... },
};
TypeScript:
export const S = {
enc(buf, v) { ... },
dec(buf) { ... },
};
// decl.d.ts
export declare var S: Type<S>;
export interface S {
Foo: number;
Bar: number;
}
JavaScript:
export const U = {
enc(buf, v) { ... },
dec(buf) { ... },
};
TypeScript:
export const U = {
enc(buf, v) { ... },
dec(buf) { ... },
};
// decl.d.ts
export declare var U: Type<U>;
export type U = number | S;