Skip to content

Commit dc12a4e

Browse files
committed
Added removal of reptition of self input types
1 parent 97e5e41 commit dc12a4e

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

rocket-chatter-ingestion-server/src/process/prepare/processor/syntax/functions.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ export namespace Functions {
1515
n.loc?.start.column ?? 0
1616
)
1717

18+
// Check for type parameters
19+
const typeParameters: string[] = []
20+
for (const p of n.typeParameters?.params ?? []) {
21+
typeParameters.push((p.name as any).name)
22+
}
23+
1824
// Handle type annotations
1925
if (n.returnType?.typeAnnotation) {
2026
node.pushUse(
@@ -95,6 +101,9 @@ export namespace Functions {
95101
}
96102
}
97103

104+
// Remove uses that uses the type parameters
105+
node.uses = node.uses.filter((u) => !typeParameters.includes(u.name))
106+
98107
return node
99108
}
100109

rocket-chatter-ingestion-server/src/process/prepare/processor/syntax/interface.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ export namespace Interface {
8787
}
8888
}
8989

90+
// Remove uses that uses the type parameters
91+
node.uses = node.uses.filter((u) => !typeParameters.includes(u.name))
92+
9093
return node
9194
}
9295
}

rocket-chatter-ingestion-server/src/process/prepare/processor/syntax/typeAlias.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export namespace TypeAlias {
2626
}))
2727
)
2828

29+
// Remove uses that uses the type parameters
30+
node.uses = node.uses.filter((u) => !typeParameters.includes(u.name))
31+
2932
return node
3033
}
3134
}

0 commit comments

Comments
 (0)