chore: Fix type error in EntityMetadata

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-06-01 09:18:00 -04:00
1 parent d1a659bf74
commit 0aaf0363c5
2 files changed
+6 -5

No files matched your search

@@ -10,6 +10,7 @@ import { once } from "lodash";
import type { Disposer, StrictReactNode } from "@k8slens/utilities";
import { iter } from "@k8slens/utilities";
import type { CategoryColumnRegistration, TitleCellProps } from "../../renderer/components/catalog/custom-category-columns";
import type { Literal, Metadata } from "../cluster-types";
export type { CategoryColumnRegistration, TitleCellProps };
@@ -232,8 +233,8 @@ export abstract class CatalogCategory extends (EventEmitter as new () => TypedEm
}
}
export type EntityMetadataObject = { [Key in string]?: EntityMetadataValue };
export type EntityMetadataValue = string | number | boolean | EntityMetadataObject | undefined;
export type EntityMetadataObject = { [key in string]?: Metadata };
export type EntityMetadataValue = Literal;
export interface CatalogEntityMetadata extends EntityMetadataObject {
uid: string;
@@ -241,7 +242,7 @@ export interface CatalogEntityMetadata extends EntityMetadataObject {
shortName?: string;
description?: string;
source?: string;
labels: Partial<Record<string, string>>;
labels: { [key in string]?: string };
}
export interface CatalogEntityStatus {
+2 -2
View File
@@ -8,7 +8,7 @@ import { z } from "zod";
/**
* JSON serializable metadata type
*/
export type ClusterMetadata = Partial<Record<string, Metadata>>;
export type ClusterMetadata = { [key in string]?: Metadata };
/**
* Metadata for cluster's prometheus settings
@@ -32,7 +32,7 @@ export type UpdateClusterModel = Omit<ClusterModel, "id">;
export type Literal = z.infer<typeof literalSchema>;
export const literalSchema = z.string().or(z.number()).or(z.boolean());
export type Metadata = Literal | { [key: string]: Metadata } | Metadata[];
export type Metadata = Literal | { [key in string]?: Metadata } | Metadata[];
export const metadataSchema: z.ZodType<Metadata> = z.lazy(() => z.union([literalSchema, z.array(metadataSchema), z.record(metadataSchema)]));
export const prometheusPreferencesSchema = z.object({