Skip to content

Commit

Permalink
Add signature to emitted create signature event
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Dec 18, 2022
1 parent c86c52e commit c40ed98
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Unreleased

### Features

- Added `ts.Signature` to emitted `EVENT_CREATE_SIGNATURE` event, #2002.

### Bug Fixes

- If `src/` and `src/x` are specified as entry points, `src/` will no longer be ignored, #2121.
Expand Down
5 changes: 3 additions & 2 deletions src/lib/converter/converter.ts
Expand Up @@ -117,8 +117,9 @@ export class Converter extends ChildableComponent<

/**
* Triggered when the converter has created a signature reflection.
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} and
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} the declaration,
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`,
* and `ts.Signature | undefined`. The signature will be undefined if the created signature is an index signature.
* @event
*/
static readonly EVENT_CREATE_SIGNATURE = ConverterEvents.CREATE_SIGNATURE;
Expand Down
8 changes: 7 additions & 1 deletion src/lib/converter/factories/signature.ts
Expand Up @@ -107,7 +107,13 @@ export function createSignature(
break;
}

context.trigger(ConverterEvents.CREATE_SIGNATURE, sigRef, declaration);
context.converter.trigger(
ConverterEvents.CREATE_SIGNATURE,
context,
sigRef,
declaration,
signature
);
}

function convertParameters(
Expand Down
1 change: 0 additions & 1 deletion src/lib/converter/symbols.ts
Expand Up @@ -419,7 +419,6 @@ function convertFunctionOrMethod(
context.finalizeDeclarationReflection(reflection);

const scope = context.withScope(reflection);
reflection.signatures ??= [];

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

0 comments on commit c40ed98

Please sign in to comment.