Skip to content

Commit f9ddcf0

Browse files
Copilothuangyiirene
andcommitted
Fix: Make name and label optional in FieldConfig to fix TypeScript compilation errors
The @objectstack/spec package requires name and label fields on the Field type, but when fields are defined in ObjectConfig.fields as a Record<string, FieldConfig>, the name is inferred from the record key. This change makes name and label optional in FieldConfig to match this usage pattern. Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent 5b07fd7 commit f9ddcf0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/foundation/types/src/field.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ export interface FieldOption {
116116
*
117117
* We make certain spec fields optional since Zod applies defaults at parse time.
118118
*/
119-
export interface FieldConfig extends Omit<Field, 'type' | 'options' | 'required' | 'multiple' | 'unique' | 'deleteBehavior' | 'hidden' | 'readonly' | 'encryption' | 'index' | 'externalId'> {
119+
export interface FieldConfig extends Omit<Field, 'name' | 'label' | 'type' | 'options' | 'required' | 'multiple' | 'unique' | 'deleteBehavior' | 'hidden' | 'readonly' | 'encryption' | 'index' | 'externalId'> {
120+
/** Field name (inferred from Record key when used in ObjectConfig.fields) */
121+
name?: string;
122+
123+
/** Display label (derived from name if not provided) */
124+
label?: string;
125+
120126
/** The data type of the field (extended with runtime types) */
121127
type: FieldType;
122128

0 commit comments

Comments
 (0)