From 26c41833cd29125a43b09faf4b6febcf67713d42 Mon Sep 17 00:00:00 2001 From: Tim deBoer Date: Fri, 7 Jun 2024 08:20:55 -0400 Subject: [PATCH] chore: support different parent/child types in tables A previous PR added support for having child items in tables, but the type of the parent and child objects is the same. For the Containers page, the parents are always ContainerGroupInfoUI and the children are always ContainerInfoUI. This change just adds an optional second type (identically to how we did rendering types in Column) so that you can declare the different types naturally as: `ContainerGroupInfoUI, ContainerInfoUI` instead of having to do: `ContainerGroupInfoUI | ContainerInfoUI` and deal with typing issues in the client code. Part of #4843. Signed-off-by: Tim deBoer --- packages/ui/src/lib/table/table.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/lib/table/table.ts b/packages/ui/src/lib/table/table.ts index 3ef07ab441e..e3ac0ac6311 100644 --- a/packages/ui/src/lib/table/table.ts +++ b/packages/ui/src/lib/table/table.ts @@ -96,7 +96,7 @@ export class Column { /** * Options to be used when creating a Row. */ -export interface RowInformation { +export interface RowInformation { /** * Returns true if a row can be selected, and false otherwise. */ @@ -110,12 +110,12 @@ export interface RowInformation { /** * Returns an array of child objects of a given row. */ - readonly children?: (object: Type) => Type[]; + readonly children?: (object: Type) => ChildType[]; } /** * A table row. */ -export class Row { - constructor(readonly info: RowInformation) {} +export class Row { + constructor(readonly info: RowInformation) {} }