DefinitelyTyped/types/viz.js/common.d.ts
mckaysalisbury b6598369a5
Adding support for viz.js (#41105)
* Adding support for viz.js

* fixing type capitalization
2020-05-04 17:42:11 -07:00

24 lines
627 B
TypeScript

interface Options {
format?: string;
engine?: string;
files?: string[];
images?: string[];
yInvert?: boolean;
}
/**
* This interface defines the shape of an object that is held by the caller.
* This `Module` was created by emscripten, and is therefore largely arcane.
* This currently just lists a subset of what is defined in `Module`.
*/
interface Module {
run(): void;
}
type RenderFunction = (instance: Module, src: string, options: Options) => string;
declare class Viz {
constructor(arg: { Module: Module; render: RenderFunction });
renderString(src: string, options?: Options): Promise<string>;
}