diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 8c9c20a14..01c390f26 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -3143,17 +3143,19 @@ extension BridgeJSLink { let sortedMethods = klass.methods.sorted { $0.name < $1.name } for method in sortedMethods { + let staticKeyword = method.effects.isStatic ? "static " : "" let methodSignature = - "\(method.name)\(renderTSSignatureCallback(method.parameters, method.returnType, method.effects));" + "\(staticKeyword)\(method.name)\(renderTSSignatureCallback(method.parameters, method.returnType, method.effects));" printer.write(methodSignature) } - let sortedProperties = klass.properties.filter { !$0.isStatic }.sorted { - $0.name < $1.name - } + let sortedProperties = klass.properties.sorted { $0.name < $1.name } for property in sortedProperties { + let staticKeyword = property.isStatic ? "static " : "" let readonly = property.isReadonly ? "readonly " : "" - printer.write("\(readonly)\(property.name): \(property.type.tsType);") + printer.write( + "\(staticKeyword)\(readonly)\(property.name): \(property.type.tsType);" + ) } printer.write("release(): void;") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts index 1353220bc..d9af0c8eb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts @@ -34,7 +34,8 @@ declare global { class Greeter { constructor(name: string); greet(): string; - makeDefault(): Greeter; + static makeDefault(): Greeter; + static readonly defaultGreeting: string; release(): void; } class UUID {