From e8920bb7a943e2cc28a4f62f5192be9961bf4a5b Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 22:04:52 +0100 Subject: [PATCH] Fix linting errors --- types/d3-fetch/index.d.ts | 62 ++++++++++++------------------------ types/d3-fetch/tsconfig.json | 1 + 2 files changed, 21 insertions(+), 42 deletions(-) diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index 6a62630808..6d4d4c7303 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -1,64 +1,42 @@ -// Type definitions for d3-fetch 1.0.1 +// Type definitions for d3-fetch 1.0 // Project: https://d3js.org/d3-fetch/ // Definitions by: Hugues Stefanski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; -/**Fetches the binary file at the specified input URL as a Blob. */ -export function blob(url: string): Promise; -/**Fetches the binary file at the specified input URL as a Blob. Passes init along to the underlying call to fetch. */ -export function blob(url: string, init: RequestInit): Promise; -/**Fetches the binary file at the specified input URL as an ArrayBuffer. */ -export function buffer(url: string): Promise; -/**Fetches the binary file at the specified input URL as an ArrayBuffer. Passes init along to the underlying call to fetch. */ -export function buffer(url: string, init: RequestInit): Promise; +/** 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; +/** 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; -/**Equivalent to d3.dsv with the comma character as the delimiter. */ -export function csv(url: string): Promise>; -/**Equivalent to d3.dsv with the comma character as the delimiter. */ -export function csv(url: string, init: RequestInit): Promise>; -/**Equivalent to d3.dsv with the comma character as the delimiter. */ +/** Equivalent to d3.dsv with the comma character as the delimiter. */ export function csv( url: string, - init: RequestInit, - row: (d: DSVRowAny) => ParsedRow + init?: RequestInit, + row?: (d: DSVRowAny) => ParsedRow ): Promise>; -/**Fetches the DSV file at the specified input URL. */ -export function dsv(delimiter: string, url: string): Promise>; -/**Fetches the DSV file at the specified input URL. */ -export function dsv(delimiter: string, url: string, init: RequestInit): Promise>; -/**Fetches the DSV file at the specified input URL. */ +/** Fetches the DSV file at the specified input URL. */ export function dsv( delimiter: string, url: string, - init: RequestInit, - row: (d: DSVRowAny) => ParsedRow + init?: RequestInit, + row?: (d: DSVRowAny) => ParsedRow ): Promise>; -/**Fetches the image at the specified input URL. */ -export function image(url: string): Promise; -/**Fetches the image at the specified input URL. Passes init along to the underlying call to fetch. */ -export function image(url: string, init: RequestInit): Promise; +/** 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; -/**Fetches the json file at the specified input URL. */ -export function json(url: string): Promise; -/**Fetches the json file at the specified input URL. Passes init along to the underlying call to fetch. */ -export function json(url: string, init: RequestInit): Promise; +/** 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. */ -export function text(url: string): Promise; -/**Fetches the text file at the specified input URL. Passes init along to the underlying call to fetch. */ -export function text(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; -/**Equivalent to d3.dsv with the tab character as the delimiter. */ -export function tsv(url: string): Promise>; -/**Equivalent to d3.dsv with the tab character as the delimiter. */ -export function tsv(url: string, init: RequestInit): Promise>; -/**Equivalent to d3.dsv with the tab character as the delimiter. */ +/** Equivalent to d3.dsv with the tab character as the delimiter. */ export function tsv( url: string, - init: RequestInit, - row: (d: DSVRowAny) => ParsedRow + init?: RequestInit, + row?: (d: DSVRowAny) => ParsedRow ): Promise>; diff --git a/types/d3-fetch/tsconfig.json b/types/d3-fetch/tsconfig.json index ea7938966e..f9b9d190dd 100644 --- a/types/d3-fetch/tsconfig.json +++ b/types/d3-fetch/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../"