Skip to content

Commit

Permalink
feat: support fields slice variation config
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed Apr 9, 2024
1 parent 8b20c5a commit 75a58a2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/types/model/sharedSliceVariation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { CustomTypeModelFieldForGroup } from "./types";
import type {
CustomTypeModelFieldForGroup,
CustomTypeModelFieldForSlice,
} from "./types";

/**
* A shared Slice variation.
Expand All @@ -10,6 +13,10 @@ import type { CustomTypeModelFieldForGroup } from "./types";
*/
export interface SharedSliceModelVariation<
ID extends string = string,
Fields extends Record<string, CustomTypeModelFieldForSlice> = Record<
string,
CustomTypeModelFieldForSlice
>,
PrimaryFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
string,
CustomTypeModelFieldForGroup
Expand All @@ -24,6 +31,7 @@ export interface SharedSliceModelVariation<
docURL: string;
version: string;
description: string;
fields?: Fields;
primary?: PrimaryFields;
items?: ItemFields;
imageUrl: string;
Expand Down
10 changes: 10 additions & 0 deletions src/types/model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,13 @@ export type CustomTypeModelFieldForGroup =
| CustomTypeModelKeyTextField
| CustomTypeModelTimestampField
| CustomTypeModelSeparatorField;

/**
* Any custom type field that is valid for a slice.
*
* **Note**: This type is only valid for a slice's `fields` property. It cannot
* be used for the deprecated `primary` or `items` properties.
*/
export type CustomTypeModelFieldForSlice =
| CustomTypeModelGroupField
| CustomTypeModelFieldForGroup;

0 comments on commit 75a58a2

Please sign in to comment.