Skip to content

Commit c40ed98

Browse files
committed
Add signature to emitted create signature event
1 parent c86c52e commit c40ed98

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unreleased
22

3+
### Features
4+
5+
- Added `ts.Signature` to emitted `EVENT_CREATE_SIGNATURE` event, #2002.
6+
37
### Bug Fixes
48

59
- If `src/` and `src/x` are specified as entry points, `src/` will no longer be ignored, #2121.

src/lib/converter/converter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ export class Converter extends ChildableComponent<
117117

118118
/**
119119
* Triggered when the converter has created a signature reflection.
120-
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} and
121-
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`
120+
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} the declaration,
121+
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`,
122+
* and `ts.Signature | undefined`. The signature will be undefined if the created signature is an index signature.
122123
* @event
123124
*/
124125
static readonly EVENT_CREATE_SIGNATURE = ConverterEvents.CREATE_SIGNATURE;

src/lib/converter/factories/signature.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ export function createSignature(
107107
break;
108108
}
109109

110-
context.trigger(ConverterEvents.CREATE_SIGNATURE, sigRef, declaration);
110+
context.converter.trigger(
111+
ConverterEvents.CREATE_SIGNATURE,
112+
context,
113+
sigRef,
114+
declaration,
115+
signature
116+
);
111117
}
112118

113119
function convertParameters(

src/lib/converter/symbols.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ function convertFunctionOrMethod(
419419
context.finalizeDeclarationReflection(reflection);
420420

421421
const scope = context.withScope(reflection);
422-
reflection.signatures ??= [];
423422

424423
// Can't use zip here. We might have less declarations than signatures
425424
// or less signatures than declarations.

0 commit comments

Comments
 (0)