@@ -636,7 +636,7 @@ export class TypeProcessor {
636636 /**
637637 * Visit a property declaration and extract metadata
638638 * @param {ts.PropertyDeclaration | ts.PropertySignature } node
639- * @returns {{ jsName: string, swiftName: string, type: string, isReadonly: boolean } | null }
639+ * @returns {{ jsName: string, swiftName: string, type: string, isReadonly: boolean, isStatic: boolean } | null }
640640 */
641641 visitPropertyDecl ( node ) {
642642 if ( ! node . name ) return null ;
@@ -656,7 +656,8 @@ export class TypeProcessor {
656656 const type = this . checker . getTypeAtLocation ( node )
657657 const swiftType = this . visitType ( type , node ) ;
658658 const isReadonly = node . modifiers ?. some ( m => m . kind === ts . SyntaxKind . ReadonlyKeyword ) ?? false ;
659- return { jsName, swiftName, type : swiftType , isReadonly } ;
659+ const isStatic = node . modifiers ?. some ( m => m . kind === ts . SyntaxKind . StaticKeyword ) ?? false ;
660+ return { jsName, swiftName, type : swiftType , isReadonly, isStatic } ;
660661 }
661662
662663 /**
@@ -993,6 +994,7 @@ export class TypeProcessor {
993994
994995 const type = property . type ;
995996 const swiftName = this . renderIdentifier ( property . swiftName ) ;
997+ const isStatic = property . isStatic ;
996998 const needsJSGetterName = property . jsName !== property . swiftName ;
997999 // Note: `from: .global` is only meaningful for top-level imports and constructors.
9981000 // Instance member access always comes from the JS object itself.
@@ -1002,10 +1004,11 @@ export class TypeProcessor {
10021004 if ( needsJSGetterName ) getterArgs . push ( `jsName: "${ this . escapeForSwiftStringLiteral ( property . jsName ) } "` ) ;
10031005 if ( fromArg ) getterArgs . push ( fromArg ) ;
10041006 const getterAnnotation = this . renderMacroAnnotation ( "JSGetter" , getterArgs ) ;
1007+ const staticKeyword = isStatic ? "static " : "" ;
10051008
10061009 // Always render getter
10071010 this . emitDocComment ( node , { indent : " " } ) ;
1008- this . swiftLines . push ( ` ${ getterAnnotation } var ${ swiftName } : ${ type } ` ) ;
1011+ this . swiftLines . push ( ` ${ getterAnnotation } ${ staticKeyword } var ${ swiftName } : ${ type } ` ) ;
10091012
10101013 // Render setter if not readonly
10111014 if ( ! property . isReadonly ) {
@@ -1018,7 +1021,7 @@ export class TypeProcessor {
10181021 if ( needsJSNameField ) setterArgs . push ( `jsName: "${ this . escapeForSwiftStringLiteral ( property . jsName ) } "` ) ;
10191022 if ( fromArg ) setterArgs . push ( fromArg ) ;
10201023 const annotation = this . renderMacroAnnotation ( "JSSetter" , setterArgs ) ;
1021- this . swiftLines . push ( ` ${ annotation } func ${ this . renderIdentifier ( setterName ) } (_ value: ${ type } ) ${ this . renderEffects ( { isAsync : false } ) } ` ) ;
1024+ this . swiftLines . push ( ` ${ annotation } ${ staticKeyword } func ${ this . renderIdentifier ( setterName ) } (_ value: ${ type } ) ${ this . renderEffects ( { isAsync : false } ) } ` ) ;
10221025 }
10231026 }
10241027
0 commit comments