Skip to content

Commit fe51565

Browse files
committed
Fix
1 parent 2846591 commit fe51565

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/build/patches.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ function handleMethodAndConstructor(
348348
const signatureIndex = child.properties?.signatureIndex;
349349
const type = handleTyped(typeNodes, child.properties?.returns);
350350

351-
let signature: OverridableMethod["signature"] = [];
351+
let signature: OverridableMethod["signature"] | undefined = undefined;
352352
if (type || params.length > 0) {
353353
// Determine the actual signature object
354354
const signatureObj: DeepPartial<Signature> = {
@@ -360,6 +360,10 @@ function handleMethodAndConstructor(
360360
} else {
361361
signature = [signatureObj];
362362
}
363+
if (signatureObj.param?.length === 0 && !signatureObj.type) {
364+
// If there are no params and no return type, remove the signature
365+
signature = undefined;
366+
}
363367
}
364368
return {
365369
name,
@@ -454,7 +458,7 @@ function convertForRemovals(obj: unknown): unknown {
454458
if (obj && typeof obj === "object") {
455459
const newObj: Record<string, unknown> = {};
456460
for (const [key, value] of Object.entries(obj)) {
457-
if (!["name", "signature"].includes(key)) {
461+
if (key !== "name") {
458462
const cleaned = convertForRemovals(value);
459463
// (intentionally covers null too)
460464
if (typeof cleaned === "object") {

0 commit comments

Comments
 (0)