@@ -80,13 +80,20 @@ export function generate(
8080) {
8181 const sf = project . createSourceFile ( options . output , undefined , { overwrite : true } ) ;
8282
83+ // generate: import type { ModelMeta } from '@zenstackhq/runtime';
84+ sf . addImportDeclaration ( {
85+ isTypeOnly : true ,
86+ namedImports : [ 'ModelMeta' ] ,
87+ moduleSpecifier : '@zenstackhq/runtime' ,
88+ } ) ;
89+
8390 const writer = new FastWriter ( ) ;
8491 const extraFunctions : OptionalKind < FunctionDeclarationStructure > [ ] = [ ] ;
8592 generateModelMetadata ( models , typeDefs , writer , options , extraFunctions ) ;
8693
8794 sf . addVariableStatement ( {
8895 declarationKind : VariableDeclarationKind . Const ,
89- declarations : [ { name : 'metadata' , initializer : writer . result } ] ,
96+ declarations : [ { name : 'metadata' , type : 'ModelMeta' , initializer : writer . result } ] ,
9097 } ) ;
9198
9299 if ( extraFunctions . length > 0 ) {
@@ -364,7 +371,7 @@ function writeFields(
364371function getAttributes ( target : DataModelField | DataModel | TypeDefField ) : RuntimeAttribute [ ] {
365372 return target . attributes
366373 . map ( ( attr ) => {
367- const args : Array < { name ?: string ; value : unknown } > = [ ] ;
374+ const args : Array < { name ?: string ; value ? : unknown } > = [ ] ;
368375 for ( const arg of attr . args ) {
369376 const argName = arg . $resolvedParam ?. name ?? arg . name ;
370377 const argValue = exprToValue ( arg . value ) ;
0 commit comments