Skip to content

Commit

Permalink
Responded to PR reviewer feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
zelliott committed Mar 30, 2022
1 parent 6165aea commit 449348a
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 38 deletions.
19 changes: 12 additions & 7 deletions apps/api-documenter/src/documenters/MarkdownDocumenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,22 @@ export class MarkdownDocumenter {

const parametersTable: DocTable = new DocTable({
configuration,
headerTitles: ['Parameter', 'Type', 'Optional', 'Description']
headerTitles: ['Parameter', 'Type', 'Description']
});
for (const apiParameter of apiParameterListMixin.parameters) {
const parameterDescription: DocSection = new DocSection({ configuration });

if (apiParameter.isOptional) {
parameterDescription.appendNodesInParagraph([
new DocEmphasisSpan({ configuration, italic: true }, [
new DocPlainText({ configuration, text: '(Optional)' })
]),
new DocPlainText({ configuration, text: ' ' })
]);
}

if (apiParameter.tsdocParamBlock) {
this._appendSection(parameterDescription, apiParameter.tsdocParamBlock.content);
this._appendAndMergeSection(parameterDescription, apiParameter.tsdocParamBlock.content);
}

parametersTable.addRow(
Expand All @@ -854,11 +864,6 @@ export class MarkdownDocumenter {
new DocTableCell({ configuration }, [
this._createParagraphForTypeExcerpt(apiParameter.parameterTypeExcerpt)
]),
new DocTableCell({ configuration }, [
new DocParagraph({ configuration }, [
new DocPlainText({ configuration, text: apiParameter.isOptional ? 'Yes' : '' })
])
]),
new DocTableCell({ configuration }, parameterDescription.nodes)
])
);
Expand Down
2 changes: 1 addition & 1 deletion apps/api-extractor/src/generators/ApiModelGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ export class ApiModelGenerator {
parameters.push({
parameterName: parameter.name.getText().trim(),
parameterTypeTokenRange,
isOptional: !!parameter.questionToken
isOptional: this._collector.typeChecker.isOptionalParameter(parameter),
});
}
return parameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ constructor(x: number);

## Parameters

| Parameter | Type | Optional | Description |
| --- | --- | --- | --- |
| x | number | | |
| Parameter | Type | Description |
| --- | --- | --- |
| x | number | |

Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ exampleFunction(a: string, b: string): string;

## Parameters

| Parameter | Type | Optional | Description |
| --- | --- | --- | --- |
| a | string | | the first string |
| b | string | | the second string |
| Parameter | Type | Description |
| --- | --- | --- |
| a | string | the first string |
| b | string | the second string |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ exampleFunction(x: number): number;

## Parameters

| Parameter | Type | Optional | Description |
| --- | --- | --- | --- |
| x | number | | the number |
| Parameter | Type | Description |
| --- | --- | --- |
| x | number | the number |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ optionalParamFunction(x?: number): void;

## Parameters

| Parameter | Type | Optional | Description |
| --- | --- | --- | --- |
| x | number | Yes | |
| Parameter | Type | Description |
| --- | --- | --- |
| x | number | <i>(Optional)</i> |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ static sumWithExample(x: number, y: number): number;

## Parameters

| Parameter | Type | Optional | Description |
| --- | --- | --- | --- |
| x | number | | the first number to add |
| y | number | | the second number to add |
| Parameter | Type | Description |
| --- | --- | --- |
| x | number | the first number to add |
| y | number | the second number to add |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export declare function exampleFunction(x: ExampleTypeAlias, y: number): IDocInt

## Parameters

| Parameter | Type | Optional | Description |
| --- | --- | --- | --- |
| x | [ExampleTypeAlias](./api-documenter-test.exampletypealias.md) | | an API item that should get hyperlinked |
| y | number | | a system type that should NOT get hyperlinked |
| Parameter | Type | Description |
| --- | --- | --- |
| x | [ExampleTypeAlias](./api-documenter-test.exampletypealias.md) | an API item that should get hyperlinked |
| y | number | a system type that should NOT get hyperlinked |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ genericReferenceMethod<T>(x: T): T;

## Parameters

| Parameter | Type | Optional | Description |
| --- | --- | --- | --- |
| x | T | | |
| Parameter | Type | Description |
| --- | --- | --- |
| x | T | |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ function nestedFunction(x: number): number;

## Parameters

| Parameter | Type | Optional | Description |
| --- | --- | --- | --- |
| x | number | | |
| Parameter | Type | Description |
| --- | --- | --- |
| x | number | |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ addHandler(handler: () => void): void;

## Parameters

| Parameter | Type | Optional | Description |
| --- | --- | --- | --- |
| handler | () =&gt; void | | |
| Parameter | Type | Description |
| --- | --- | --- |
| handler | () =&gt; void | |

<b>Returns:</b>

Expand Down

0 comments on commit 449348a

Please sign in to comment.