diff --git a/packages/databricks-vscode/src/bundle/types.ts b/packages/databricks-vscode/src/bundle/types.ts index a3fcc7b4f..e1bd8e445 100644 --- a/packages/databricks-vscode/src/bundle/types.ts +++ b/packages/databricks-vscode/src/bundle/types.ts @@ -1,40 +1,19 @@ import {BundleSchema as OriginalBundleSchema} from "./BundleSchema"; type RemoveStringFromUnion = T extends string ? never : T; - -type RemoveStringFromType = T extends object +type RemoveStringFromUnionTypes = T extends object ? { [K in keyof T]: T[K] extends string | undefined ? T[K] - : RemoveStringFromType; + : RemoveStringFromUnionTypes; } : RemoveStringFromUnion; -export type BundleTarget = Omit< - RemoveStringFromType>["targets"][string], - "variables" -> & { - // Use custom override for in-target variable type, because CLI < v0.215.0 - // uses the same class for both in-target and global variables. - // TODO: Remove this override when fixed in CLI (> v0.215.0). - variables?: { - [k: string]: ( - | string - | Required< - RemoveStringFromType< - Required - >["variables"][string] - >["lookup"] - ) & {value?: string}; - }; -}; - -export type BundleSchema = Omit< - RemoveStringFromType, - "targets" -> & { - targets?: {[k: string]: BundleTarget}; -}; +// CLI generates schema with additional string types added for almost complex sub types (to support complex variables). +// We usually work with `bundle validate` or `summary` outputs, which have expanded variables, so we don't need +// to account for additional string types. +export type BundleSchema = RemoveStringFromUnionTypes; +export type BundleTarget = Required["targets"][string]; export type Resources = T extends {resources?: infer D} ? D : never; export type ResourceKey = keyof Resources;