Skip to content

Commit b1fb45e

Browse files
authored
BridgeJS: Add missing function keyword for namespace function declarations in TypeScript (swiftwasm#592)
1 parent 6b3a697 commit b1fb45e

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3094,7 +3094,7 @@ extension BridgeJSLink {
30943094
let sortedFunctions = childNode.content.functions.sorted { $0.name < $1.name }
30953095
for function in sortedFunctions {
30963096
let signature =
3097-
"\(function.name)\(renderTSSignatureCallback(function.parameters, function.returnType, function.effects));"
3097+
"function \(function.name)\(renderTSSignatureCallback(function.parameters, function.returnType, function.effects));"
30983098
printer.write(signature)
30993099
}
31003100
let sortedProperties = childNode.content.staticProperties.sorted { $0.name < $1.name }

Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ declare global {
6161
namespace Services {
6262
namespace Graph {
6363
namespace GraphOperations {
64-
createGraph(rootId: number): number;
65-
nodeCount(graphId: number): number;
66-
validate(graphId: number): boolean;
64+
function createGraph(rootId: number): number;
65+
function nodeCount(graphId: number): number;
66+
function validate(graphId: number): boolean;
6767
}
6868
}
6969
}

Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ declare global {
1212
constructor();
1313
greet(): string;
1414
}
15-
globalFunction(): string;
15+
function globalFunction(): string;
1616
}
1717
}
1818

Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export {};
99
declare global {
1010
namespace MyModule {
1111
namespace Utils {
12-
namespacedFunction(): string;
12+
function namespacedFunction(): string;
1313
}
1414
}
1515
namespace Utils {

Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export {};
3333
declare global {
3434
namespace Utils {
3535
namespace String {
36-
uppercase(text: string): string;
36+
function uppercase(text: string): string;
3737
}
3838
}
3939
}

Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Generated TypeScript definitions:
140140
declare global {
141141
namespace Utils {
142142
namespace String {
143-
uppercase(text: string): string;
143+
function uppercase(text: string): string;
144144
}
145145
}
146146
}

0 commit comments

Comments
 (0)