From c68acf8a3461c1dda866b5ca3be8a4a8a94fa501 Mon Sep 17 00:00:00 2001 From: Catherine Liu Date: Thu, 21 Oct 2021 18:14:41 -0700 Subject: [PATCH] Fixed ts errors --- .../canvas_plugin_src/functions/external/embeddable.ts | 2 +- x-pack/plugins/canvas/public/application.tsx | 1 - x-pack/plugins/canvas/types/functions.ts | 10 ++++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/external/embeddable.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/external/embeddable.ts index 248eacd71a555..14b6df97534b9 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/external/embeddable.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/external/embeddable.ts @@ -14,7 +14,7 @@ import { getQueryFilters } from '../../../common/lib/build_embeddable_filters'; import { decode, encode } from '../../../common/lib/embeddable_dataurl'; import { InitializeArguments } from '.'; -interface Arguments { +export interface Arguments { config: string; type: string; } diff --git a/x-pack/plugins/canvas/public/application.tsx b/x-pack/plugins/canvas/public/application.tsx index cb08201490f74..04d3958b68e36 100644 --- a/x-pack/plugins/canvas/public/application.tsx +++ b/x-pack/plugins/canvas/public/application.tsx @@ -111,7 +111,6 @@ export const initializeCanvas = async ( prependBasePath: coreStart.http.basePath.prepend, types: setupPlugins.expressions.getTypes(), paletteService: await setupPlugins.charts.palettes.getPalettes(), - embeddablesService: startPlugins.embeddable, }); for (const fn of canvasFunctions) { diff --git a/x-pack/plugins/canvas/types/functions.ts b/x-pack/plugins/canvas/types/functions.ts index 2569e0b10685b..c80102915ed95 100644 --- a/x-pack/plugins/canvas/types/functions.ts +++ b/x-pack/plugins/canvas/types/functions.ts @@ -10,8 +10,8 @@ import { UnwrapPromiseOrReturn } from '@kbn/utility-types'; import { functions as commonFunctions } from '../canvas_plugin_src/functions/common'; import { functions as browserFunctions } from '../canvas_plugin_src/functions/browser'; import { functions as serverFunctions } from '../canvas_plugin_src/functions/server'; -import { functions as externalFunctions } from '../canvas_plugin_src/functions/external'; -import { initFunctions } from '../public/functions'; +import { initFunctions as initExternalFunctions } from '../canvas_plugin_src/functions/external'; +import { initFunctions as initClientFunctions } from '../public/functions'; /** * A `ExpressionFunctionFactory` is a powerful type used for any function that produces @@ -90,9 +90,11 @@ export type FunctionFactory = type CommonFunction = FunctionFactory; type BrowserFunction = FunctionFactory; type ServerFunction = FunctionFactory; -type ExternalFunction = FunctionFactory; +type ExternalFunction = FunctionFactory< + ReturnType extends Array ? U : never +>; type ClientFunctions = FunctionFactory< - ReturnType extends Array ? U : never + ReturnType extends Array ? U : never >; /**