Chore: Improve typings (#88282)
* remove some type assertions * some more type assertion fixes * nicer * shortcircuit while loop when hitting something that isn't an HTMLElement
This commit is contained in:
@@ -149,7 +149,7 @@ function convertGraphSeriesToDataFrame(graphSeries: GraphSeriesXY): DataFrame {
|
||||
}
|
||||
|
||||
function convertJSONDocumentDataToDataFrame(timeSeries: TimeSeries): DataFrame {
|
||||
const fields = [
|
||||
const fields: Field[] = [
|
||||
{
|
||||
name: timeSeries.target,
|
||||
type: FieldType.other,
|
||||
@@ -158,7 +158,7 @@ function convertJSONDocumentDataToDataFrame(timeSeries: TimeSeries): DataFrame {
|
||||
unit: timeSeries.unit,
|
||||
filterable: (timeSeries as any).filterable,
|
||||
},
|
||||
values: [] as TimeSeriesValue[][],
|
||||
values: [],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -315,11 +315,11 @@ export function toDataFrame(data: any): DataFrame {
|
||||
if ('fields' in data) {
|
||||
// DataFrameDTO does not have length
|
||||
if ('length' in data && data.fields[0]?.values?.get) {
|
||||
return data as DataFrame;
|
||||
return data;
|
||||
}
|
||||
|
||||
// This will convert the array values into Vectors
|
||||
return createDataFrame(data as DataFrameDTO);
|
||||
return createDataFrame(data);
|
||||
}
|
||||
|
||||
// Handle legacy docs/json type
|
||||
|
||||
Reference in New Issue
Block a user