@@ -2,7 +2,7 @@ import * as fs from 'fs';
22import * as path from 'path' ;
33import chalk from 'chalk' ;
44import * as yaml from 'js-yaml' ;
5- import { IntrospectedSchema , IntrospectedTable , IntrospectedColumn , ObjectConfig , IObjectQL } from '@objectql/types' ;
5+ import { IntrospectedSchema , IntrospectedTable , IntrospectedColumn , ObjectConfig , IObjectQL , FieldConfig } from '@objectql/types' ;
66
77interface SyncOptions {
88 config ?: string ;
@@ -148,7 +148,7 @@ function generateObjectDefinition(table: IntrospectedTable, schema: Introspected
148148 continue ;
149149 }
150150
151- const field : any = { } ;
151+ const field : Partial < FieldConfig > = { } ;
152152
153153 // Check if this is a foreign key
154154 const fk = table . foreignKeys . find ( fk => fk . columnName === column . name ) ;
@@ -167,7 +167,7 @@ function generateObjectDefinition(table: IntrospectedTable, schema: Introspected
167167 } else {
168168 // Regular field - map SQL type to ObjectQL type
169169 const fieldType = mapSqlTypeToObjectQL ( column . type , column ) ;
170- field . type = fieldType ;
170+ field . type = fieldType as any ; // Type assertion needed as mapSqlTypeToObjectQL returns string
171171
172172 // Add label
173173 field . label = formatLabel ( column . name ) ;
@@ -181,9 +181,9 @@ function generateObjectDefinition(table: IntrospectedTable, schema: Introspected
181181 field . unique = true ;
182182 }
183183
184- // Add maxLength for text-based fields
184+ // Add max_length for text-based fields
185185 if ( column . maxLength && ( fieldType === 'text' || fieldType === 'textarea' ) ) {
186- field . maxLength = column . maxLength ;
186+ field . max_length = column . maxLength ;
187187 }
188188
189189 if ( column . defaultValue !== undefined && column . defaultValue !== null ) {
@@ -196,7 +196,7 @@ function generateObjectDefinition(table: IntrospectedTable, schema: Introspected
196196 }
197197 }
198198
199- obj . fields [ column . name ] = field ;
199+ obj . fields [ column . name ] = field as FieldConfig ;
200200 }
201201
202202 return obj ;
0 commit comments