diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index 54ddb5ea11..b99c81e39a 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -796,7 +796,7 @@ newDiv2 = body.append(function(d, i, g) { const index: number = i; const group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('Body element foo property: ', d.foo); // data of type BodyDatum - return this.ownerDocument.createElement('div'); // this-type HTMLBodyElement + return this.ownerDocument!.createElement('div'); // this-type HTMLBodyElement }); // newDiv2 = body.append(function(d) { @@ -828,7 +828,7 @@ const typeValueFunction = function( i: number, g: HTMLBodyElement[] | d3Selection.ArrayLike ) { - return this.ownerDocument.createElement('p'); // this-type HTMLParagraphElement + return this.ownerDocument!.createElement('p'); // this-type HTMLParagraphElement }; const beforeValueFunction = function( diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index d1e127dfdf..d9988636fd 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -22,7 +22,7 @@ export type BaseType = Element | EnterElement | Document | Window | null; */ export interface ArrayLike { length: number; - item(index: number): T; + item(index: number): T | null; [index: number]: T; }