mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-02 13:00:35 +00:00
* Updated d3-geo to reflect version 1.9.0: added fitWidth and fitHeight methods * Fix asterisk position * Missing space * Added spacing between methods * Added tests for d3-geo `fitHeight` and `fitWidth` * Backbone for d3-fetch * Completed fetch API * Strong typings of parsing methods * Partial d3-fetch tests * Completed tests for d3-fetch * Reste library to es6 in d3-fetch * Fix linting errors * tentative fix TS 2.1 * Specific types for d3-fetch * Fix test on d3-fetch * Removed generic used only once for json function in d3-fetch * Fix d3-fetch test
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import * as d3Fetch from 'd3-fetch';
|
|
import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv';
|
|
|
|
interface MyType {
|
|
foo: string;
|
|
}
|
|
|
|
const url = 'foo.bar';
|
|
|
|
const init: RequestInit = {};
|
|
|
|
let p1: Promise<Blob> = d3Fetch.blob(url);
|
|
p1 = d3Fetch.blob(url, init);
|
|
let p2: Promise<ArrayBuffer> = d3Fetch.buffer(url);
|
|
p2 = d3Fetch.buffer(url, init);
|
|
let p3: Promise<HTMLImageElement> = d3Fetch.image(url);
|
|
p3 = d3Fetch.image(url, init);
|
|
let p4: Promise<any> = d3Fetch.json(url);
|
|
p4 = d3Fetch.json(url, init);
|
|
|
|
let myString: Promise<string>;
|
|
myString = d3Fetch.text(url);
|
|
myString = d3Fetch.text(url, init);
|
|
|
|
const parseRow = (d: {}) => {
|
|
const myType: MyType = { foo: 'foo' };
|
|
return myType;
|
|
};
|
|
let promise2: Promise<DSVParsedArray<MyType>>;
|
|
promise2 = d3Fetch.csv<MyType>(url);
|
|
promise2 = d3Fetch.csv<MyType>(url, init);
|
|
promise2 = d3Fetch.csv<MyType>(url, init, parseRow);
|
|
promise2 = d3Fetch.dsv<MyType>(';', url);
|
|
promise2 = d3Fetch.dsv<MyType>(';', url, init);
|
|
promise2 = d3Fetch.dsv<MyType>(';', url, init, parseRow);
|
|
promise2 = d3Fetch.tsv<MyType>(url);
|
|
promise2 = d3Fetch.tsv<MyType>(url, init);
|
|
promise2 = d3Fetch.tsv<MyType>(url, init, parseRow);
|