From 7abf322d4eeed043575c2e9234c54ff2d693816f Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Tue, 29 Jan 2019 00:39:51 +0100 Subject: [PATCH] [vis] DataSet.get may return null + type parameter for DataSet.map (#32570) --- types/vis/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/vis/index.d.ts b/types/vis/index.d.ts index 84ff769270..187c01c9b7 100644 --- a/types/vis/index.d.ts +++ b/types/vis/index.d.ts @@ -459,7 +459,7 @@ export class DataSet { * @returns When no item is found, null is returned when a single item was requested, * and and empty Array is returned in case of multiple id's. */ - get(id: IdType, options?: DataSelectionOptions): T; + get(id: IdType, options?: DataSelectionOptions): T|null; /** * Get multiple items from the DataSet. @@ -494,7 +494,7 @@ export class DataSet { * @param [options] Optional options. * @returns The mapped items. */ - map(callback: (item: T, id: IdType) => any, options?: DataSelectionOptions): any[]; + map(callback: (item: T, id: IdType) => M, options?: DataSelectionOptions): M[]; /** * Find the item with maximum value of specified field. @@ -589,7 +589,7 @@ export interface DataSelectionOptions { /** * Order the items by a field name or custom sort function. */ - order?: string | any; + order?: string | ((a: T, b: T) => number); /** * Determine the type of output of the get function. @@ -597,7 +597,7 @@ export interface DataSelectionOptions { * The default returnType is an Array. * The Object type will return a JSON object with the ID's as keys. */ - returnType?: string; + returnType?: "Array" | "Object"; } export class DataView {