mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-02 21:10:30 +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
43 lines
2.0 KiB
TypeScript
43 lines
2.0 KiB
TypeScript
// Type definitions for d3-fetch 1.0
|
|
// Project: https://d3js.org/d3-fetch/
|
|
// Definitions by: Hugues Stefanski <https://github.com/ledragon>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.2
|
|
import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv';
|
|
|
|
/** Fetches the binary file at the specified input URL as a Blob. If init is specified, it is passed along to the underlying call to fetch. */
|
|
export function blob(url: string, init?: RequestInit): Promise<Blob>;
|
|
/** Fetches the binary file at the specified input URL as an ArrayBuffer. If init is specified, it is passed along to the underlying call to fetch. */
|
|
export function buffer(url: string, init?: RequestInit): Promise<ArrayBuffer>;
|
|
|
|
/** Equivalent to d3.dsv with the comma character as the delimiter. */
|
|
export function csv<ParsedRow extends DSVRowAny>(
|
|
url: string,
|
|
init?: RequestInit,
|
|
row?: (d: DSVRowAny) => ParsedRow
|
|
): Promise<DSVParsedArray<ParsedRow>>;
|
|
|
|
/** Fetches the DSV file at the specified input URL. */
|
|
export function dsv<ParsedRow extends DSVRowAny>(
|
|
delimiter: string,
|
|
url: string,
|
|
init?: RequestInit,
|
|
row?: (d: DSVRowAny) => ParsedRow
|
|
): Promise<DSVParsedArray<ParsedRow>>;
|
|
|
|
/** Fetches the image at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */
|
|
export function image(url: string, init?: RequestInit): Promise<HTMLImageElement>;
|
|
|
|
/** Fetches the json file at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */
|
|
export function json(url: string, init?: RequestInit): Promise<{}>;
|
|
|
|
/** Fetches the text file at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */
|
|
export function text(url: string, init?: RequestInit): Promise<string>;
|
|
|
|
/** Equivalent to d3.dsv with the tab character as the delimiter. */
|
|
export function tsv<ParsedRow extends DSVRowAny>(
|
|
url: string,
|
|
init?: RequestInit,
|
|
row?: (d: DSVRowAny) => ParsedRow
|
|
): Promise<DSVParsedArray<ParsedRow>>;
|