Skip to content

Commit fc7aff6

Browse files
TS2Swift: only const callable exports become JSFunction
1 parent 27c3d53 commit fc7aff6

File tree

1 file changed

+2
-1
lines changed
  • Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src

1 file changed

+2
-1
lines changed

Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ export class TypeProcessor {
261261
if (!isExported) return;
262262

263263
const fromArg = this.renderDefaultJSImportFromArgument();
264+
const isConst = (node.declarationList.flags & ts.NodeFlags.Const) !== 0;
264265

265266
for (const decl of node.declarationList.declarations) {
266267
if (!ts.isIdentifier(decl.name)) continue;
@@ -278,7 +279,7 @@ export class TypeProcessor {
278279
if (fromArg) args.push(fromArg);
279280
const callSignatures = type.getCallSignatures();
280281

281-
if (callSignatures.length > 0) {
282+
if (isConst && callSignatures.length > 0) {
282283
const signature = callSignatures[0];
283284
const parameters = signature.getParameters();
284285
const parameterNameMap = this.buildParameterNameMap(parameters);

0 commit comments

Comments
 (0)