Skip to content

Commit dd5502e

Browse files
committed
-
1 parent 3402469 commit dd5502e

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

src/build/patches.ts

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ function handleMixinandInterfaces(
173173
if (method[methodName]) {
174174
// ts: The goal here is to merge multiple method signatures together for methods with the same name.
175175
const existingSig = method[methodName].signature;
176-
const newSigEntry = Array.isArray(m.signature) ? m.signature[0] : m.signature && (m.signature as any)[0];
176+
const newSigEntry = Array.isArray(m.signature)
177+
? m.signature[0]
178+
: m.signature && (m.signature as any)[0];
177179
if (Array.isArray(existingSig)) {
178180
// Both are arrays, push new entry (if newSigEntry is available)
179181
if (newSigEntry !== undefined) {
@@ -187,11 +189,14 @@ function handleMixinandInterfaces(
187189
// Existing is an object, add next numeric key
188190
let nextKey = 0;
189191
// Only own, string keys that are numbers
190-
while (Object.prototype.hasOwnProperty.call(existingSig, String(nextKey))) {
192+
while (
193+
Object.prototype.hasOwnProperty.call(existingSig, String(nextKey))
194+
) {
191195
nextKey++;
192196
}
193197
if (newSigEntry !== undefined) {
194-
(existingSig as Record<string, any>)[String(nextKey)] = newSigEntry;
198+
(existingSig as Record<string, any>)[String(nextKey)] =
199+
newSigEntry;
195200
}
196201
}
197202
break;
@@ -293,14 +298,23 @@ function handleMethod(child: Node): Partial<Method> {
293298
}
294299
}
295300

296-
const signature: DeepPartial<Signature>[] | Record<string, DeepPartial<Signature>> = child.properties?.overrideType ? {"0": {overrideType: string(child.properties?.overrideType), param: params}} : [
297-
{
298-
param: params,
299-
...(typeNode
300-
? handleTyped(typeNode)
301-
: { type: string(child.properties?.returns) }),
302-
},
303-
];
301+
const signature:
302+
| DeepPartial<Signature>[]
303+
| Record<string, DeepPartial<Signature>> = child.properties?.overrideType
304+
? {
305+
"0": {
306+
overrideType: string(child.properties?.overrideType),
307+
param: params,
308+
},
309+
}
310+
: [
311+
{
312+
param: params,
313+
...(typeNode
314+
? handleTyped(typeNode)
315+
: { type: string(child.properties?.returns) }),
316+
},
317+
];
304318
return { name, signature } as Partial<Method>;
305319
}
306320

0 commit comments

Comments
 (0)