DefinitelyTyped/types/d3-graphviz/d3-graphviz-tests.ts
DomParfitt 78715c422a Adding d3-graphviz definition (#29741)
* Initial commit

* Began defining functions

* Added top level exported function, options interface and Graphviz object interface

* Added more definitions

* Added dom lib

* Added more definitions

* Updated config

* Added required TS version

* Updated some parameters to be optional

* Updated definitions per API

* Fixed selection extension methods

* Added module declaration

* Formatting

* Updated names

* Re-ordered to match the API with sections

* Added Engine type

* Added TypeNames type

* Added KeyMode type

* Added more definitions and comments

* Updated to use generics matching other d3 libraries

* Updated arrays to be fixed size

* Added documentation

* Updated return type

* Added some tests

* Made parameter optional

* Updated DOT attributes

* Updated callbacks

* Linting fixes

* Removed unnecessary generics

* Updated callbacks
2018-10-15 12:51:57 -07:00

17 lines
507 B
TypeScript

import { select, BaseType } from 'd3-selection';
import * as d3Graphviz from 'd3-graphviz';
let graphviz: d3Graphviz.Graphviz<BaseType, any, BaseType, any>;
// Can get a graphviz render using extension method on d3-select
graphviz = select('test').graphviz();
// Can use graphviz method as selector
graphviz = d3Graphviz.graphviz('test');
// Can get the options
const options: d3Graphviz.GraphvizOptions = d3Graphviz.graphviz('').options();
// Can set the options
graphviz = graphviz.options(options);