mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
remove anys in drilldowns plugin (#111305)
This commit is contained in:
parent
05d9bc53fb
commit
5e5dd07470
4 changed files with 12 additions and 8 deletions
|
@ -262,7 +262,7 @@ describe('UrlDrilldown', () => {
|
|||
indexPatterns: [{ id: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' }],
|
||||
}
|
||||
);
|
||||
const data: any = {
|
||||
const data = {
|
||||
data: [
|
||||
createPoint({ field: 'field0', value: 'value0' }),
|
||||
createPoint({ field: 'field1', value: 'value1' }),
|
||||
|
|
|
@ -54,7 +54,7 @@ export interface ContextValues {
|
|||
panel: PanelValues;
|
||||
}
|
||||
|
||||
function hasSavedObjectId(obj: Record<string, any>): obj is { savedObjectId: string } {
|
||||
function hasSavedObjectId(obj: Record<string, unknown>): obj is { savedObjectId: string } {
|
||||
return 'savedObjectId' in obj && typeof obj.savedObjectId === 'string';
|
||||
}
|
||||
|
||||
|
@ -64,12 +64,13 @@ function hasSavedObjectId(obj: Record<string, any>): obj is { savedObjectId: str
|
|||
*/
|
||||
function getIndexPatternIds(output: EmbeddableOutput): string[] {
|
||||
function hasIndexPatterns(
|
||||
_output: Record<string, any>
|
||||
_output: unknown
|
||||
): _output is { indexPatterns: Array<{ id?: string }> } {
|
||||
return (
|
||||
'indexPatterns' in _output &&
|
||||
Array.isArray(_output.indexPatterns) &&
|
||||
_output.indexPatterns.length > 0
|
||||
typeof _output === 'object' &&
|
||||
!!_output &&
|
||||
Array.isArray((_output as { indexPatterns: unknown[] }).indexPatterns) &&
|
||||
(_output as { indexPatterns: Array<{ id?: string }> }).indexPatterns.length > 0
|
||||
);
|
||||
}
|
||||
return hasIndexPatterns(output)
|
||||
|
|
|
@ -53,7 +53,10 @@ describe('VALUE_CLICK_TRIGGER', () => {
|
|||
|
||||
describe('handles undefined, null or missing values', () => {
|
||||
test('undefined or missing values are removed from the result scope', () => {
|
||||
const point = createPoint({ field: undefined } as any);
|
||||
const point = createPoint(({ field: undefined } as unknown) as {
|
||||
field: string;
|
||||
value: string | null | number | boolean;
|
||||
});
|
||||
const eventScope = getEventScopeValues({
|
||||
data: { data: [point] },
|
||||
}) as ValueClickTriggerEventScope;
|
||||
|
|
|
@ -15,7 +15,7 @@ export const toPrimitiveOrUndefined = (v: unknown): Primitive | undefined => {
|
|||
return String(v);
|
||||
};
|
||||
|
||||
export const deleteUndefinedKeys = <T extends Record<string, any>>(obj: T): T => {
|
||||
export const deleteUndefinedKeys = <T extends Record<string, unknown>>(obj: T): T => {
|
||||
Object.keys(obj).forEach((key) => {
|
||||
if (obj[key] === undefined) {
|
||||
delete obj[key];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue