Chore + Typo Correction:

* New Line at end.
* No trailing whitespaces (including within commentes.)
* Indenting in accordance with editorconfig.
* Corrected typo in comment in d3-random
This commit is contained in:
Tom Wanzek
2016-07-28 18:32:00 -04:00
parent 0a2db7b31e
commit e511e4819e
75 changed files with 616 additions and 616 deletions

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-array module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -548,4 +548,4 @@ num = d3.thresholdFreedmanDiaconis([-1, 0, 1, 1, 3, 20, 234], -1, 234);
num = d3.thresholdScott([-1, 0, 1, 1, 3, 20, 234], -1, 234);
num = d3.thresholdSturges([-1, 0, 1, 1, 3, 20, 234]);
num = d3.thresholdSturges([-1, 0, 1, 1, 3, 20, 234]);

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-array-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-array-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-axis module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -149,4 +149,4 @@ let canvasSelection: Selection<HTMLCanvasElement, any, any, any>;
let canvasTransition = canvasSelection.transition();
// canvasSelection.call(rightAxis); // fails, incompatible context container element
// canvasTransition.call(rightAxis); // fails, incompatible context container element
// canvasTransition.call(rightAxis); // fails, incompatible context container element

6
d3-axis/index.d.ts vendored
View File

@@ -8,7 +8,7 @@ import { Selection, TransitionLike } from 'd3-selection';
// TODO: The below import is commented out, as d3-axis does not have a dependency
// on d3-time. d3-time may only be loaded, if the use case requires a TimeInterval (or CountableTimeInterval)
// for an axis. In which case, the ticks(...) signature with interval argument, would be best-specified
// with the below import.
// with the below import.
// import { TimeInterval } from 'd3-time';
@@ -46,7 +46,7 @@ export interface Axis<Domain> {
// ticks(interval: TimeInterval, specifier?: string): Axis<Domain>;
// HACK: use `any` instead of TimeInterval
// HACK: use `any` instead of TimeInterval
ticks(interval: any, specifier?: string): Axis<Domain>;
ticks(arg0: any, ...args: any[]): Axis<Domain>;
tickArguments(): any[];
@@ -71,4 +71,4 @@ export interface Axis<Domain> {
export function axisTop<Domain>(scale: AxisScale<Domain>): Axis<Domain>;
export function axisRight<Domain>(scale: AxisScale<Domain>): Axis<Domain>;
export function axisBottom<Domain>(scale: AxisScale<Domain>): Axis<Domain>;
export function axisLeft<Domain>(scale: AxisScale<Domain>): Axis<Domain>;
export function axisLeft<Domain>(scale: AxisScale<Domain>): Axis<Domain>;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-axis-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-axis-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-brush module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -182,4 +182,4 @@ let e: d3Brush.D3BrushEvent<BrushDatum>;
let target: d3Brush.BrushBehavior<BrushDatum> = e.target;
let type: 'start' | 'brush' | 'end' | string = e.type;
let brushSelection: d3Brush.BrushSelection = e.selection;
let sourceEvent: any = e.sourceEvent;
let sourceEvent: any = e.sourceEvent;

6
d3-brush/index.d.ts vendored
View File

@@ -6,8 +6,8 @@
import { ArrayLike, Selection, TransitionLike } from 'd3-selection';
/**
* Type alias for a BrushSelection. For a two-dimensional brush, it must be defined as [[x0, y0], [x1, y1]],
* where x0 is the minimum x-value, y0 is the minimum y-value, x1 is the maximum x-value, and y1 is the maximum y-value.
* Type alias for a BrushSelection. For a two-dimensional brush, it must be defined as [[x0, y0], [x1, y1]],
* where x0 is the minimum x-value, y0 is the minimum y-value, x1 is the maximum x-value, and y1 is the maximum y-value.
* For an x-brush, it must be defined as [x0, x1]; for a y-brush, it must be defined as [y0, y1].
*/
export type BrushSelection = [[number, number], [number, number]] | [number, number];
@@ -43,4 +43,4 @@ export interface D3BrushEvent<Datum> {
type: 'start' | 'brush' | 'end' | string; // Leave failsafe string type for cases like 'brush.foo'
selection: BrushSelection;
sourceEvent: any;
}
}

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-brush-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-brush-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-chord module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -183,4 +183,4 @@ ribbonPaths = select<SVGGElement, any>('g')
.selectAll()
.data(function (chords) { return chords; })
.enter().append<SVGPathElement>('path')
.attr('d', svgRibbon);
.attr('d', svgRibbon);

2
d3-chord/index.d.ts vendored
View File

@@ -75,4 +75,4 @@ export interface RibbonGenerator<This, ChordDatum, ChordSubgroupDatum> {
export function ribbon(): RibbonGenerator<any, Chord, ChordSubgroup>;
export function ribbon<Datum, SubgroupDatum>(): RibbonGenerator<any, Datum, SubgroupDatum>;
export function ribbon<This, Datum, SubgroupDatum>(): RibbonGenerator<This, Datum, SubgroupDatum>;
export function ribbon<This, Datum, SubgroupDatum>(): RibbonGenerator<This, Datum, SubgroupDatum>;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-chord-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-chord-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-collection module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -179,7 +179,7 @@ basicSet = d3Collection.set(testObjArray, function (value, index, array) {
return v.name;
});
// from existing set
// from existing set
basicSet = d3Collection.set(basicSet);
@@ -366,4 +366,4 @@ num = testL2NestedArray[0].values[0].values[0].yield; // access chain to leaf pr
testL1NestedArrayRollup = nestL1Rollup.entries(raw);
num = testL1NestedArrayRollup[0].value; // get rollup value
num = testL1NestedArrayRollup[0].value; // get rollup value

View File

@@ -95,7 +95,7 @@ export function set<T>(array: Array<T>, key: (value: T, index?: number, array?:
// if AT LEAST ONE KEY was set. This seems a reasonable constraint in practice, given the intent of the nest operator.
// Otherwise, an additional '| Array<Datum> | RollupType` would have to be added to the union type. This would cover
// cases (a) without key or rollup (b) without key but with rollup. However, again, the union types make it cumbersome
// without much gain.
// without much gain.
export interface NestedArray<Datum, RollupType> extends Array<{ key: string, values: NestedArray<Datum, RollupType> | Array<Datum> | undefined, value: RollupType | undefined }> { }
export interface NestedMap<Datum, RollupType> extends Map<NestedMap<Datum, RollupType> | Array<Datum> | RollupType> { }
@@ -114,4 +114,4 @@ interface Nest<Datum, RollupType> {
}
export function nest<Datum>(): Nest<Datum, undefined>;
export function nest<Datum, RollupType>(): Nest<Datum, RollupType>;
export function nest<Datum, RollupType>(): Nest<Datum, RollupType>;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-collection-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-collection-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-color module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -127,4 +127,4 @@ cRGB = cCubehelix.rgb();
displayable = cCubehelix.displayable();
cString = cCubehelix.toString();
console.log('Channels = (h : %d, s: %d, l: %d)', cCubehelix.h, cCubehelix.s, cCubehelix.l);
console.log('Opacity = %d', cCubehelix.opacity);
console.log('Opacity = %d', cCubehelix.opacity);

13
d3-color/index.d.ts vendored
View File

@@ -21,7 +21,7 @@ export interface Color {
export interface ColorFactory extends Function {
(cssColorSpecifier: string): RGBColor | HSLColor;
(color: ColorSpaceObject): RGBColor | HSLColor;
// prototype: Color;
// prototype: Color;
}
export interface RGBColor extends Color {
@@ -40,7 +40,7 @@ export interface RGBColorFactory extends Function {
(r: number, g: number, b: number, opacity?: number): RGBColor;
(cssColorSpecifier: string): RGBColor;
(color: ColorSpaceObject): RGBColor;
// prototype: RGBColor;
// prototype: RGBColor;
}
export interface HSLColor extends Color {
@@ -58,7 +58,7 @@ export interface HSLColorFactory extends Function {
(h: number, s: number, l: number, opacity?: number): HSLColor;
(cssColorSpecifier: string): HSLColor;
(color: ColorSpaceObject): HSLColor;
// prototype: HSLColor;
// prototype: HSLColor;
}
export interface LabColor extends Color {
@@ -75,7 +75,7 @@ export interface LabColorFactory extends Function {
(l: number, a: number, b: number, opacity?: number): LabColor;
(cssColorSpecifier: string): LabColor;
(color: ColorSpaceObject): LabColor;
// prototype: LabColor;
// prototype: LabColor;
}
export interface HCLColor extends Color {
@@ -92,7 +92,7 @@ export interface HCLColorFactory extends Function {
(h: number, l: number, c: number, opacity?: number): HCLColor;
(cssColorSpecifier: string): HCLColor;
(color: ColorSpaceObject): HCLColor;
// prototype: HCLColor;
// prototype: HCLColor;
}
export interface CubehelixColor extends Color {
@@ -109,7 +109,7 @@ export interface CubehelixColorFactory extends Function {
(h: number, s: number, l: number, opacity?: number): CubehelixColor;
(cssColorSpecifier: string): CubehelixColor;
(color: ColorSpaceObject): CubehelixColor;
// prototype: CubehelixColor;
// prototype: CubehelixColor;
}
// --------------------------------------------------------------------------
@@ -127,3 +127,4 @@ export var lab: LabColorFactory;
export var hcl: HCLColorFactory;
export var cubehelix: CubehelixColorFactory;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-color-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-color-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-dispatch module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -25,12 +25,12 @@ let dispatch: d3Dispatch.Dispatch<HTMLElement>,
dispatch = d3Dispatch.dispatch('foo', 'bar');
function cbFn (this: HTMLElement, d: Datum, i: number) {
function cbFn(this: HTMLElement, d: Datum, i: number) {
console.log(this.baseURI ? this.baseURI : 'nada');
console.log(d ? d.a : 'nada');
};
function cbFn2 (this: SVGElement, d: Datum, i: number) {
function cbFn2(this: SVGElement, d: Datum, i: number) {
console.log(this.baseURI ? this.baseURI : 'nada');
console.log(d ? d.a : 'nada');
};
@@ -52,4 +52,4 @@ dispatch.on('bar', null);
// Copy dispatch -----------------------------------------------
copy = dispatch.copy();
// copy2 = dispatch.copy(); // test fails type mismatch of underlying event target
// copy2 = dispatch.copy(); // test fails type mismatch of underlying event target

View File

@@ -13,4 +13,4 @@ export interface Dispatch<T extends EventTarget> {
on(typenames: string, callback: (this: T, ...args: any[]) => void): Dispatch<T>;
}
export function dispatch<T extends EventTarget>(...types: string[]): Dispatch<T>;
export function dispatch<T extends EventTarget>(...types: string[]): Dispatch<T>;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-dispatch-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-dispatch-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-drag module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -11,7 +11,7 @@ import { event, select, Selection } from 'd3-selection';
// NB: Consider alternative approachto getting live event-binding
// when using webpack as suggested by @ocombe in response to
// event binding question https://github.com/d3/d3-zoom/issues/32#issuecomment-229889310
// event binding question https://github.com/d3/d3-zoom/issues/32#issuecomment-229889310
// d3.getEvent = () => require("d3-selection").event;
//
// This can be used in callbacks

6
d3-drag/index.d.ts vendored
View File

@@ -26,7 +26,7 @@ export type DragContainerElement = HTMLElement | SVGSVGElement | SVGGElement; //
/**
* The subject datum should at a minimum expose x and y properties, so that the relative position
* of the subject and the pointer can be preserved during the drag gesture.
* of the subject and the pointer can be preserved during the drag gesture.
*/
export interface SubjectPosition {
x: number;
@@ -38,8 +38,8 @@ export interface DragBehavior<GElement extends DraggedElementBaseType, Datum, Su
container(): (this: GElement, datum?: Datum, index?: number, group?: Array<GElement> | ArrayLike<GElement>) => DragContainerElement;
container(accessor: (this: GElement, datum?: Datum, index?: number, group?: Array<GElement> | ArrayLike<GElement>) => DragContainerElement): DragBehavior<GElement, Datum, Subject>;
container(container: DragContainerElement): DragBehavior<GElement, Datum, Subject>;
filter(): (this: GElement, datum?: Datum, index?: number, group?: Array<GElement>| ArrayLike<GElement>) => boolean;
filter(filterFn: (this: GElement, datum?: Datum, index?: number, group?: Array<GElement>| ArrayLike<GElement>) => boolean): DragBehavior<GElement, Datum, Subject>;
filter(): (this: GElement, datum?: Datum, index?: number, group?: Array<GElement> | ArrayLike<GElement>) => boolean;
filter(filterFn: (this: GElement, datum?: Datum, index?: number, group?: Array<GElement> | ArrayLike<GElement>) => boolean): DragBehavior<GElement, Datum, Subject>;
subject(): (this: GElement, datum?: Datum, index?: number, group?: Array<GElement> | ArrayLike<GElement>) => Subject;
subject(accessor: (this: GElement, datum?: Datum, index?: number, group?: Array<GElement> | ArrayLike<GElement>) => Subject): DragBehavior<GElement, Datum, Subject>;
on(typenames: string): (this: GElement, datum?: Datum, index?: number, group?: Array<GElement> | ArrayLike<GElement>) => any;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-drag-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-drag-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-ease module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.

2
d3-ease/index.d.ts vendored
View File

@@ -53,4 +53,4 @@ export function easeBackInOut(normalizedTime: number): number;
export function easeElastic(normalizedTime: number): number;
export function easeElasticIn(normalizedTime: number): number;
export function easeElasticOut(normalizedTime: number): number;
export function easeElasticInOut(normalizedTime: number): number;
export function easeElasticInOut(normalizedTime: number): number;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-ease-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-ease-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-force module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -524,4 +524,4 @@ nodeLinkSimulation.tick();
// find() -----------------------------------------------------------------------------
simNode = nodeLinkSimulation.find(100, 100);
simNode = nodeLinkSimulation.find(100, 100, 20);
simNode = nodeLinkSimulation.find(100, 100, 20);

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-force-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-force-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-format module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -79,5 +79,5 @@ localeObj = d3Format.formatLocale(localeDef);
localeObj = d3Format.formatDefaultLocale(localeDef);
let formatFactory: (specifier: string) => ((n: number) => string) = localeObj.format;
let formatPrefixFactory: (specifier: string, value: number) => ((n: number) => string) = localeObj.formatPrefix;
let formatFactory: (specifier: string) => ((n: number) => string) = localeObj.format;
let formatPrefixFactory: (specifier: string, value: number) => ((n: number) => string) = localeObj.formatPrefix;

36
d3-format/index.d.ts vendored
View File

@@ -30,19 +30,19 @@ export interface FormatLocaleDefinition {
export interface FormatLocaleObject {
/**
* Returns a new format function for the given string specifier. The returned function
* Returns a new format function for the given string specifier. The returned function
* takes a number as the only argument, and returns a string representing the formatted number.
*
*
* @param specifier A Specifier string
*/
format(specifier: string): (n: number) => string;
/**
* Returns a new format function for the given string specifier. The returned function
* Returns a new format function for the given string specifier. The returned function
* takes a number as the only argument, and returns a string representing the formatted number.
* The returned function will convert values to the units of the appropriate SI prefix for the
* The returned function will convert values to the units of the appropriate SI prefix for the
* specified numeric reference value before formatting in fixed point notation.
*
*
* @param specifier A Specifier string
* @param value The reference value to determine the appropriate SI prefix.
*/
@@ -77,39 +77,39 @@ export function formatLocale(locale: FormatLocaleDefinition): FormatLocaleObject
export function formatDefaultLocale(defaultLocale: FormatLocaleDefinition): FormatLocaleObject;
/**
* Returns a new format function for the given string specifier. The returned function
* Returns a new format function for the given string specifier. The returned function
* takes a number as the only argument, and returns a string representing the formatted number.
*
*
* Uses the current default locale.
*
*
* @param specifier A Specifier string
*/
export function format(specifier: string): (n: number) => string;
/**
* Returns a new format function for the given string specifier. The returned function
* Returns a new format function for the given string specifier. The returned function
* takes a number as the only argument, and returns a string representing the formatted number.
* The returned function will convert values to the units of the appropriate SI prefix for the
* The returned function will convert values to the units of the appropriate SI prefix for the
* specified numeric reference value before formatting in fixed point notation.
*
*
* Uses the current default locale.
*
*
* @param specifier A Specifier string
* @param value The reference value to determine the appropriate SI prefix.
*/
export function formatPrefix(specifier: string, value: number): (n: number) => string;
/**
* Parses the specified specifier, returning an object with exposed fields that correspond to the
* Parses the specified specifier, returning an object with exposed fields that correspond to the
* format specification mini-language and a toString method that reconstructs the specifier.
*
*
* @param specifier A specifier string.
*/
export function formatSpecifier(specifier: string): FormatSpecifier;
/**
* Returns a suggested decimal precision for fixed point notation given the specified numeric step value.
*
*
* @param step The step represents the minimum absolute difference between values that will be formatted.
* (This assumes that the values to be formatted are also multiples of step.)
*/
@@ -118,7 +118,7 @@ export function precisionFixed(step: number): number;
/**
* Returns a suggested decimal precision for use with locale.formatPrefix given the specified
* numeric step and reference value.
*
*
* @param step The step represents the minimum absolute difference between values that will be formatted.
* (This assumes that the values to be formatted are also multiples of step.)
* @param value Reference value determines which SI prefix will be used.
@@ -127,9 +127,9 @@ export function precisionPrefix(step: number, value: number): number;
/**
* Returns a suggested decimal precision for format types that round to significant digits
* Returns a suggested decimal precision for format types that round to significant digits
* given the specified numeric step and max values.
*
*
* @param step The step represents the minimum absolute difference between values that will be formatted.
* (This assumes that the values to be formatted are also multiples of step.)
* @param max max represents the largest absolute value that will be formatted.

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-hierarchy module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -819,4 +819,4 @@ circles = d3Hierarchy.packSiblings(circles);
let enclosure: { r: number, x: number, y: number };
enclosure = d3Hierarchy.packEnclose(circles);
enclosure = d3Hierarchy.packEnclose(circles);

View File

@@ -312,4 +312,4 @@ export interface PackCircle {
export function packSiblings<Datum extends PackCircle>(circles: Array<Datum>): Array<Datum>;
export function packEnclose<Datum extends PackCircle>(circles: Array<Datum>): { r: number, x: number, y: number };
export function packEnclose<Datum extends PackCircle>(circles: Array<Datum>): { r: number, x: number, y: number };

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-hierarchy-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-hierarchy-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-interpolate module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-interpolate-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-interpolate-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-path module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -38,4 +38,4 @@ context.rect(60, 60, 100, 200);
context.closePath();
let pathString: string = context.toString();
let pathString: string = context.toString();

2
d3-path/index.d.ts vendored
View File

@@ -15,4 +15,4 @@ export interface Path {
toString(): string;
}
export function path(): Path;
export function path(): Path;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-path-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-path-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-polygon module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -31,4 +31,4 @@ hull = d3Polygon.polygonHull(pointArray);
containsFlag = d3Polygon.polygonContains(polygon, point);
num = d3Polygon.polygonLength(polygon);
num = d3Polygon.polygonLength(polygon);

14
d3-polygon/index.d.ts vendored
View File

@@ -5,32 +5,32 @@
/**
* Returns the signed area of the specified polygon. If the vertices of the polygon are in counterclockwise order (
* assuming a coordinate system where the origin ⟨0,0⟩ is in the top-left corner), the returned area is positive;
* assuming a coordinate system where the origin ⟨0,0⟩ is in the top-left corner), the returned area is positive;
* otherwise it is negative, or zero.
*
*
* @param polygon Array of coordinates <x0, y0>, <x1, y1> and so on.
*/
export function polygonArea(polygon: Array<[number, number]>): number;
/**
* Returns the centroid of the specified polygon.
*
*
* @param polygon Array of coordinates <x0, y0>, <x1, y1> and so on.
*/
export function polygonCentroid(polygon: Array<[number, number]>): [number, number];
/**
* Returns the convex hull of the specified points using Andrews monotone chain algorithm.
* The returned hull is represented as an array containing a subset of the input points arranged in
* The returned hull is represented as an array containing a subset of the input points arranged in
* counterclockwise order. Returns null if points has fewer than three elements.
*
*
* @param points Array of coordinates <x0, y0>, <x1, y1> and so on.
*/
export function polygonHull(points: Array<[number, number]>): Array<[number, number]> | null;
/**
* Returns true if and only if the specified point is inside the specified polygon.
*
*
* @param polygon Array of coordinates <x0, y0>, <x1, y1> and so on.
* @param point Coordinates of point <x, y>
*/
@@ -38,7 +38,7 @@ export function polygonContains(polygon: Array<[number, number]>, point: [number
/**
* Returns the length of the perimeter of the specified polygon.
*
*
* @param polygon Array of coordinates <x0, y0>, <x1, y1> and so on.
*/
export function polygonLength(polygon: Array<[number, number]>): number;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-polygon-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-polygon-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-quadtree module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -242,4 +242,4 @@ let quadNode: d3Quadtree.QuadtreeInternalNode<TestDatum> | d3Quadtree.QuadtreeLe
quadNode = internalNode[0];
quadNode = internalNode[1];
quadNode = internalNode[2];
quadNode = internalNode[3];
quadNode = internalNode[3];

View File

@@ -17,7 +17,7 @@ export interface QuadtreeLeaf<T> {
* 1 - the top-right quadrant, if any.
* 2 - the bottom-left quadrant, if any.
* 3 - the bottom-right quadrant, if any.
*
*
* A child quadrant may be undefined if it is empty.
*/
export interface QuadtreeInternalNode<T> extends Array<QuadtreeInternalNode<T> | QuadtreeLeaf<T> | undefined> {}
@@ -47,4 +47,4 @@ export interface Quadtree<T> {
export function quadtree(): Quadtree<[number, number]>;
export function quadtree(data: Array<[number, number]>): Quadtree<[number, number]>;
export function quadtree<T>(): Quadtree<T>;
export function quadtree<T>(data: Array<T>, x?: (d: T) => number, y?: (d: T) => number): Quadtree<T>;
export function quadtree<T>(data: Array<T>, x?: (d: T) => number, y?: (d: T) => number): Quadtree<T>;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-quadtree-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-quadtree-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-queue module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -92,4 +92,4 @@ qWithResults = d3Queue.queue()
console.log(results[0], results[1]);
});
qWithResults.abort();
qWithResults.abort();

28
d3-queue/index.d.ts vendored
View File

@@ -9,36 +9,36 @@
export interface Queue {
/**
* Adds the specified asynchronous task callback to the queue, with any optional arguments.
*
* @param task Task to be executed.The task is a function that will be called when the task should start. It is passed the
* specified optional arguments and an additional callback as the last argument;
* the callback must be invoked by the task when it finishes.
* The task must invoke the callback with two arguments: the error, if any, and the result of the task.
*
* @param task Task to be executed.The task is a function that will be called when the task should start. It is passed the
* specified optional arguments and an additional callback as the last argument;
* the callback must be invoked by the task when it finishes.
* The task must invoke the callback with two arguments: the error, if any, and the result of the task.
* To return multiple results from a single callback, wrap the results in an object or array.
* @param args Additional, optional arguments to be passed into deferred task on invocation
*/
defer(task: (...args: Array<any>) => void, ...args: any[]): this;
/**
* Aborts any active tasks, invoking each active tasks task.abort function, if any.
* Also prevents any new tasks from starting, and immediately invokes the queue.await or
* Aborts any active tasks, invoking each active tasks task.abort function, if any.
* Also prevents any new tasks from starting, and immediately invokes the queue.await or
* queue.awaitAll callback with an error indicating that the queue was aborted.
*/
abort(): this;
/**
* Sets the callback to be invoked when all deferred tasks have finished (individual result arguments).
*
*
* @param callback Callback function to be executed, when error occured or all deferred tasks
* have completed. The first argument to the callback is the first error that occurred, or null if no error occurred.
* If an error occurred, there are no additional arguments to the callback. Otherwise,
* have completed. The first argument to the callback is the first error that occurred, or null if no error occurred.
* If an error occurred, there are no additional arguments to the callback. Otherwise,
* the callback is passed each result as an additional argument.
*/
await(callback: (error: any | null, ...results: Array<any>) => void): this;
/**
* Sets the callback to be invoked when all deferred tasks have finished (results array).
*
*
* @param callback Callback function to be executed, when error occured or all deferred tasks
* have completed. The first argument to the callback is the first error that occurred,
* or null if no error occurred. If an error occurred, there are no additional arguments to the callback.
* or null if no error occurred. If an error occurred, there are no additional arguments to the callback.
* Otherwise, the callback is also passed an array of results as the second argument.
*/
awaitAll(callback: (error: any | null, results?: Array<any>) => void): this;
@@ -49,7 +49,7 @@ export interface Queue {
* Otherwise, concurrency is a positive integer. For example, if concurrency is 1, then all tasks will be run in series.
* If concurrency is 3, then at most three tasks will be allowed to proceed concurrently; this is useful, for example,
* when loading resources in a web browser.
*
*
* @param concurrency Maximum number of deferred tasks to execute concurrently.
*/
export function queue(concurrency?: number): Queue;
export function queue(concurrency?: number): Queue;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-queue-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-queue-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-random module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.

16
d3-random/index.d.ts vendored
View File

@@ -4,27 +4,27 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Returns a function for generating random numbers with a uniform distribution).
* The minimum allowed value of a returned number is min, and the maximum is max.
* Returns a function for generating random numbers with a uniform distribution).
* The minimum allowed value of a returned number is min, and the maximum is max.
* If min is not specified, it defaults to 0; if max is not specified, it defaults to 1.
*/
export function randomUniform(min?: number, max?: number): () => number;
/**
* Returns a function for generating random numbers with a normal (Gaussian) distribution.
* The expected value of the generated numbers is mu, with the given standard deviation sigma.
* Returns a function for generating random numbers with a normal (Gaussian) distribution.
* The expected value of the generated numbers is mu, with the given standard deviation sigma.
* If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1.
*/
export function randomNormal(mu?: number, sigma?: number): () => number;
/**
* Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variables natural logrithm is mu,
* Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variables natural logrithm is mu,
* with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1.
*/
export function randomLogNormal(mu?: number, sigma?: number): () => number;
/**
* eturns a function for generating random numbers with a Bates distribution with n independent variables.
* Returns a function for generating random numbers with a Bates distribution with n independent variables.
*/
export function randomBates(n: number): () => number;
@@ -34,7 +34,7 @@ export function randomBates(n: number): () => number;
export function randomIrwinHall(n: number): () => number;
/**
* Returns a function for generating random numbers with an exponential distribution with the rate lambda;
* Returns a function for generating random numbers with an exponential distribution with the rate lambda;
* equivalent to time between events in a Poisson process with a mean of 1 / lambda.
*/
export function randomExponential(lambda: number): () => number;
export function randomExponential(lambda: number): () => number;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-random-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-random-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-scale module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -996,4 +996,4 @@ colorStrings = d3Scale.schemeCategory20;
colorStrings = d3Scale.schemeCategory20b;
colorStrings = d3Scale.schemeCategory20c;
colorStrings = d3Scale.schemeCategory20c;

2
d3-scale/index.d.ts vendored
View File

@@ -384,7 +384,7 @@ export interface ScalePoint<Domain extends { toString(): string }> {
*/
padding(): number;
/**
* Sets the outer padding to the specified value which must be in the range [0, 1].
* Sets the outer padding to the specified value which must be in the range [0, 1].
* The outer padding determines the ratio of the range that is reserved for blank space
* before the first point and after the last point.
*/

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-scale-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-scale-tests.ts"
]
}

View File

@@ -1,7 +1,7 @@
/**
* Typescript definition tests for d3/d3-selection module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -154,7 +154,7 @@ let documentLinks: d3Selection.Selection<HTMLAnchorElement | HTMLAreaElement, an
// Expected: datum propagates down from selected element to sub-selected descendant element
// Parent element and Parent Datum of sub-selected element is the same as starting selection
// Using select(...) sub-selection with a string argument.
// Using select(...) sub-selection with a string argument.
let svgEl: d3Selection.Selection<SVGSVGElement, SVGDatum, HTMLElement, any> = d3Selection.select<SVGSVGElement, SVGDatum>('svg');
@@ -375,7 +375,7 @@ circles = circles
.property('__hitchhikersguide__', {
value: 42,
survival: 'towel'
}); // any
}); // any
circles = circles
.property('__hitchhikersguide__', function (d, i, group) {
@@ -542,7 +542,7 @@ circles2 = d3Selection.select<SVGSVGElement, any>('#svg2')
circles2 = circles2 // returned update selection has the same type parameters as original selection, if data type is unchanged
.data<CircleDatumAlternative>(endCircleData, function (d) { return d.nodeId; });
// circles2.data<DivDatum>(endCircleData, function (d) { return d.nodeId; }); // fails, forced data type parameter and data argument mismatch
// circles2.data<DivDatum>(endCircleData, function (d) { return d.nodeId; }); // fails, forced data type parameter and data argument mismatch
// ENTER-selection -----------------------------------------------------------------
@@ -612,7 +612,7 @@ tr = d3Selection.select('body')
// .data<number[]>([{test: 1}, {test: 2}]) // fails, using this data statement instead, would fail because of its type parameter not being met by input
.enter().append<HTMLTableRowElement>('tr');
nMatrix = tr.data(); // i.e. matrix
nMatrix = tr.data(); // i.e. matrix
let td: d3Selection.Selection<HTMLTableDataCellElement, number, HTMLTableRowElement, number[]>;
td = tr.selectAll()
@@ -633,7 +633,7 @@ let tr2 = d3Selection.select('body')
.data(matrix)
.enter().append('tr');
nMatrix = tr2.data(); // i.e. matrix
nMatrix = tr2.data(); // i.e. matrix
let td2 = tr2.selectAll('td')
.data(function (d) { return d; }) // d : Array<number> inferred (Array[4] of number per parent <tr>)
@@ -773,7 +773,7 @@ function enforceMinRadius(selection: d3Selection.Selection<SVGCircleElement, Cir
}
// returns 'this' selection
circles = circles.call(enforceMinRadius, 40); // check chaining return type by re-assigning
circles = circles.call(enforceMinRadius, 40); // check chaining return type by re-assigning
// circles.call(function (selection: d3Selection.Selection<HTMLDivElement, CircleDatum, any, any>):void {
// // fails, group element types of selection not compatible: SVGCircleElement v HTMLDivElement

View File

@@ -82,7 +82,7 @@ export interface TransitionLike<GElement extends BaseType, Datum> {
// --------------------------------------------------------------------------
// NB: Note that, d3.select does not generate the same parent element, when targeting the same DOM element with string selector
// or node element
// or node element
export function select<GElement extends BaseType, OldDatum>(selector: string): Selection<GElement, OldDatum, HTMLElement, any>;
export function select<GElement extends BaseType, OldDatum>(node: GElement): Selection<GElement, OldDatum, null, undefined>;
@@ -273,7 +273,7 @@ export interface Local {
set(node: Element, value: any): Element;
/**
* Obtain a string with the internally assigned property name for the local
* which is used to store the value on a node
* which is used to store the value on a node
*/
toString(): string;
}
@@ -306,8 +306,8 @@ export type NamespaceLocalObject = {
* name of local by parsing a shorthand string "prefix:local". If the prefix
* does not exist in the "namespaces" object provided by d3-selection, then
* the local name is returned as a simple string.
*
* @param prefixedLocal A string composed of the namespace prefix and local
*
* @param prefixedLocal A string composed of the namespace prefix and local
* name separated by colon, e.g. "svg:text".
*/
export function namespace(prefixedLocal: string): NamespaceLocalObject | string;
@@ -345,7 +345,7 @@ export function window(DOMNode: Window | Document | Element): Window;
* Returns a closure structure which can be invoked in the 'this' context
* of a group element. Depending on the use of namespacing, the NewGElement can be HTMLElement,
* SVGElement an extension thereof or an element from a different namespace.
*
*
* @param elementName Name of the element to be added
*/
export function creator<NewGElement extends Element>(elementName: string): (this: BaseType) => NewGElement;
@@ -353,7 +353,7 @@ export function creator<NewGElement extends Element>(elementName: string): (this
/**
* Returns a closure structure which can be invoked in the 'this' context
* of a group element. Returns true, if the element in the 'this' context matches the selector
*
*
* @param selector A valid selector string
*/
export function matcher<GElement extends Element>(selector: string): (this: BaseType) => boolean;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-selection-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-selection-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-shape module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -1145,4 +1145,4 @@ order = d3Shape.stackOrderReverse(seriesAnyAny);
d3Shape.stackOffsetExpand(seriesAnyAny, order);
d3Shape.stackOffsetNone(seriesAnyAny, order);
d3Shape.stackOffsetSilhouette(seriesAnyAny, order);
d3Shape.stackOffsetWiggle(seriesAnyAny, order);
d3Shape.stackOffsetWiggle(seriesAnyAny, order);

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-shape-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-shape-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-time-format module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.

View File

@@ -74,4 +74,4 @@ export function utcParse(specifier: string): (dateString: string) => (Date | nul
export function isoFormat(date: Date): string;
export function isoParse(dateString: string): Date;
export function isoParse(dateString: string): Date;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-time-format-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-time-format-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-time module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -210,4 +210,4 @@ dateArray = d3Time.utcMonths(start, end, 3);
countableI = d3Time.utcYear;
dateArray = d3Time.utcYears(start, end);
dateArray = d3Time.utcYears(start, end, 2);
dateArray = d3Time.utcYears(start, end, 2);

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-time-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-time-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-timer module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.

10
d3-timer/index.d.ts vendored
View File

@@ -4,9 +4,9 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Returns the current time as defined by performance.now if available, and Date.now if not.
* Returns the current time as defined by performance.now if available, and Date.now if not.
* The current time is updated at the start of a frame; it is thus consistent during the frame, and any timers scheduled during the same frame will be synchronized.
* If this method is called outside of a frame, such as in response to a user event, the current time is calculated and then fixed until the next frame,
* If this method is called outside of a frame, such as in response to a user event, the current time is calculated and then fixed until the next frame,
* again ensuring consistent timing during event handling.
*/
export function now(): number;
@@ -33,7 +33,7 @@ export interface Timer {
/**
* Schedules and returns a new timer, invoking the specified callback repeatedly until the timer is stopped.
* The callback is passed the (apparent) elapsed time since the timer became active.
*
*
* @param callback A callback function to be invoked and passed in the apparent
* elapsed time since the timer became active in milliseconds.
* @param [delay] An optional numeric delay in milliseconds (default = 0) relative to time.
@@ -49,7 +49,7 @@ export function timerFlush(): void;
/**
* Schedules and returns a new timer, invoking the specified callback. The timer is stopped automatically
* on its first callback. The callback is passed the (apparent) elapsed time since the timer became active.
*
*
* @param callback A callback function to be invoked and passed in the apparent
* elapsed time since the timer became active in milliseconds.
* @param [delay] An optional numeric delay in milliseconds (default = 0) relative to time.
@@ -61,7 +61,7 @@ export function timeout(callback: (elapsed: number) => void, delay?: number, tim
* Schedules and returns a new timer, invoking the specified callback repeatedly every 'delay' milliseconds
* until the timer is stopped.
* The callback is passed the (apparent) elapsed time since the timer became active.
*
*
* @param callback A callback function to be invoked and passed in the apparent
* elapsed time since the timer became active in milliseconds.
* @param [delay] An optional numeric delay in milliseconds between repeat invocations of the callback.

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-timer-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-timer-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-transition module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -329,7 +329,7 @@ function changeExitColor(transition: d3Transition.Transition<SVGCircleElement, C
}
// returns 'this' transition
exitTransition = exitTransition.call(changeExitColor, 'midnightblue', 'black'); // check chaining return type by re-assigning
exitTransition = exitTransition.call(changeExitColor, 'midnightblue', 'black'); // check chaining return type by re-assigning
// exitTransition.call(function (transition: d3Transition.Transition<HTMLDivElement, CircleDatum, any, any>): void {
// // fails, group element types of selection not compatible: SVGCircleElement v HTMLDivElement
@@ -388,4 +388,4 @@ updateTransitionActive = d3Transition.active<SVGCircleElement, CircleDatum, SVGS
// interrupt(...) ----------------------------------------------------------
d3Transition.interrupt(topTransition.selection().node());
d3Transition.interrupt(topTransition.selection().node(), 'top');
d3Transition.interrupt(topTransition.selection().node(), 'top');

View File

@@ -99,4 +99,3 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
export function transition(name: string): Transition<HTMLElement, any, null, undefined>;
export function transition<GElement extends BaseType, Datum, PElement extends BaseType, PDatum>(transition: Transition<GElement, Datum, PElement, PDatum>): Transition<GElement, Datum, PElement, PDatum>;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-transition-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-transition-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-voronoi module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
@@ -223,4 +223,4 @@ links = voronoiDiagram.links();
link = links[0];
testDatum = link.source;
testDatum = link.target;
testDatum = link.target;

View File

@@ -11,14 +11,14 @@
/**
* The Point type is defined as a cue that the array is strictly of type [number, number] with two elements
* for x and y coordinates. However, it is used as a base for interface definitions, and [number, number]
* cannot be extended.
* cannot be extended.
*/
export type VoronoiPoint = Array<number>;
/**
* The PointPair type is defined as a cue that the array is strictly of type [[number, number], [number, number]] with two elements, one
* for each point containing the respective x and y coordinates. However, it is used as a base for interface definitions, and
* [[number, number], [number, number]]cannot be extended.
* for each point containing the respective x and y coordinates. However, it is used as a base for interface definitions, and
* [[number, number], [number, number]]cannot be extended.
*/
export type VoronoiPointPair = Array<[number, number]> // [Point, Point];
@@ -78,4 +78,4 @@ export interface VoronoiDiagram<T> {
// --------------------------------------------------------------------------
export function voronoi(): VoronoiLayout<[number, number]>;
export function voronoi<T>(): VoronoiLayout<T>;
export function voronoi<T>(): VoronoiLayout<T>;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-voronoi-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-voronoi-tests.ts"
]
}

View File

@@ -1,6 +1,6 @@
/**
* Typescript definition tests for d3/d3-zoom module
*
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.

2
d3-zoom/index.d.ts vendored
View File

@@ -135,4 +135,4 @@ export interface ZoomTransform {
export function zoomTransform(node: ZoomedElementBaseType): ZoomTransform;
export const zoomIdentity: ZoomTransform;
export const zoomIdentity: ZoomTransform;

View File

@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-zoom-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-zoom-tests.ts"
]
}