diff --git a/src/engine/datatype/ListDataType.ts b/src/engine/datatype/ListDataType.ts index 1c065915..726371c6 100644 --- a/src/engine/datatype/ListDataType.ts +++ b/src/engine/datatype/ListDataType.ts @@ -8,10 +8,18 @@ import { } from './DataType'; import { ComplexDataType, isComplexDataType } from './ComplexDataType'; +export type ListDataTypeBuildSetupType = { + description?: string; + itemType: Entity | DataType | ComplexDataType | DataTypeFunction; + minItems?: number; + maxItems?: number; + required?: boolean; +}; + export type ListDataTypeSetupType = { name: string; description: string; - itemType: Entity | ComplexDataType | DataTypeFunction; + itemType: Entity | DataType | ComplexDataType | DataTypeFunction; minItems?: number; maxItems?: number; }; @@ -147,9 +155,9 @@ export const isListDataType = (obj: unknown): obj is ListDataType => { return obj instanceof ListDataType; }; -export const buildListDataType = (obj: { - itemType: Entity | DataType | ComplexDataType | DataTypeFunction; -}): DataTypeFunction => { +export const buildListDataType = ( + obj: ListDataTypeBuildSetupType, +): DataTypeFunction => { return ({ setup: { name, description } }): ListDataType => new ListDataType({ description, diff --git a/src/index.ts b/src/index.ts index b638c1e3..d6a97b23 100644 --- a/src/index.ts +++ b/src/index.ts @@ -132,6 +132,7 @@ import { ListDataType, isListDataType, buildListDataType, + ListDataTypeSetupType, } from './engine/datatype/ListDataType'; import { Language } from './engine/models/Language'; @@ -224,6 +225,7 @@ export { ListDataType, isListDataType, buildListDataType, + ListDataTypeSetupType, passOrThrow, resolveFunctionMap, isMap,