@@ -654,7 +654,7 @@ export class TypeProcessor {
654654 /**
655655 * Visit a property declaration and extract metadata
656656 * @param {ts.PropertyDeclaration | ts.PropertySignature } node
657- * @returns {{ jsName: string, swiftName: string, type: string, isReadonly: boolean } | null }
657+ * @returns {{ jsName: string, swiftName: string, type: string, isReadonly: boolean, isStatic: boolean } | null }
658658 */
659659 visitPropertyDecl ( node ) {
660660 if ( ! node . name ) return null ;
@@ -674,7 +674,8 @@ export class TypeProcessor {
674674 const type = this . checker . getTypeAtLocation ( node )
675675 const swiftType = this . visitType ( type , node ) ;
676676 const isReadonly = node . modifiers ?. some ( m => m . kind === ts . SyntaxKind . ReadonlyKeyword ) ?? false ;
677- return { jsName, swiftName, type : swiftType , isReadonly } ;
677+ const isStatic = node . modifiers ?. some ( m => m . kind === ts . SyntaxKind . StaticKeyword ) ?? false ;
678+ return { jsName, swiftName, type : swiftType , isReadonly, isStatic } ;
678679 }
679680
680681 /**
@@ -1011,6 +1012,7 @@ export class TypeProcessor {
10111012
10121013 const type = property . type ;
10131014 const swiftName = this . renderIdentifier ( property . swiftName ) ;
1015+ const isStatic = property . isStatic ;
10141016 const needsJSGetterName = property . jsName !== property . swiftName ;
10151017 // Note: `from: .global` is only meaningful for top-level imports and constructors.
10161018 // Instance member access always comes from the JS object itself.
@@ -1020,10 +1022,11 @@ export class TypeProcessor {
10201022 if ( needsJSGetterName ) getterArgs . push ( `jsName: "${ this . escapeForSwiftStringLiteral ( property . jsName ) } "` ) ;
10211023 if ( fromArg ) getterArgs . push ( fromArg ) ;
10221024 const getterAnnotation = this . renderMacroAnnotation ( "JSGetter" , getterArgs ) ;
1025+ const staticKeyword = isStatic ? "static " : "" ;
10231026
10241027 // Always render getter
10251028 this . emitDocComment ( node , { indent : " " } ) ;
1026- this . swiftLines . push ( ` ${ getterAnnotation } var ${ swiftName } : ${ type } ` ) ;
1029+ this . swiftLines . push ( ` ${ getterAnnotation } ${ staticKeyword } var ${ swiftName } : ${ type } ` ) ;
10271030
10281031 // Render setter if not readonly
10291032 if ( ! property . isReadonly ) {
@@ -1036,7 +1039,7 @@ export class TypeProcessor {
10361039 if ( needsJSNameField ) setterArgs . push ( `jsName: "${ this . escapeForSwiftStringLiteral ( property . jsName ) } "` ) ;
10371040 if ( fromArg ) setterArgs . push ( fromArg ) ;
10381041 const annotation = this . renderMacroAnnotation ( "JSSetter" , setterArgs ) ;
1039- this . swiftLines . push ( ` ${ annotation } func ${ this . renderIdentifier ( setterName ) } (_ value: ${ type } ) ${ this . renderEffects ( { isAsync : false } ) } ` ) ;
1042+ this . swiftLines . push ( ` ${ annotation } ${ staticKeyword } func ${ this . renderIdentifier ( setterName ) } (_ value: ${ type } ) ${ this . renderEffects ( { isAsync : false } ) } ` ) ;
10401043 }
10411044 }
10421045
0 commit comments