Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 34 additions & 75 deletions packages/ts-docs-gen/examples/simple/docs/api/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[InterfaceDeclaration-1]: index.md#foo
[InterfaceDeclaration-2]: index.md#boo
[InterfaceDeclaration-4]: index.md#myconstrainttype
[InterfaceDeclaration-9]: index.md#dictionary
[InterfaceDeclaration-9]: index.md#dictionary
[InterfaceDeclaration-6]: index.md#objectsinterface
[InterfaceDeclaration-12]: index.md#monsterinterface
[InterfaceDeclaration-1]: index.md#interface-foo
[InterfaceDeclaration-2]: index.md#interface-boo
[InterfaceDeclaration-4]: index.md#interface-myconstrainttype
[InterfaceDeclaration-9]: index.md#interface-dictionary
[InterfaceDeclaration-9]: index.md#interface-dictionary
[InterfaceDeclaration-6]: index.md#interface-objectsinterface
[InterfaceDeclaration-12]: index.md#interface-monsterinterface
[ClassDeclaration-0]: index/hello.md#hello
# index

Expand Down Expand Up @@ -80,26 +80,23 @@ interface AnotherInterface {
<TValue>(param1: TValue, param2: TValue): boolean
```

Type parameters:
**Type parameters:**

| Name |
| ------ |
| TValue |

Parameters:
**Parameters:**

| Name | Type |
| ------ | ------ |
| param1 | TValue |
| param2 | TValue |

Return type:
**Return type:**

true | false

---


## interface MyConstraintType

```typescript
Expand Down Expand Up @@ -162,19 +159,16 @@ interface InterfaceWithCall {
<T>(): { someProperty: T; }
```

Type parameters:
**Type parameters:**

| Name |
| ---- |
| T |

Return type:
**Return type:**

{ someProperty: T; }

---


## interface InterfaceWithConstraintType

```typescript
Expand Down Expand Up @@ -214,29 +208,24 @@ interface InterfaceWithMethod<T> {
someMethodOne(): T
```

Return type:
**Return type:**

T

---

```typescript
someMethodTwo<TReturn>(): TReturn
```

Type parameters:
**Type parameters:**

| Name |
| ------- |
| TReturn |

Return type:
**Return type:**

TReturn

---


## interface Dictionary

```typescript
Expand All @@ -258,12 +247,10 @@ interface Dictionary<TValue> {
new (): Dictionary<TValue>
```

Return type:
**Return type:**

[Dictionary][InterfaceDeclaration-9]&#60;TValue&#62;

---

### Index signatures

```typescript
Expand All @@ -274,9 +261,6 @@ Index `key` - string

Type - TValue

---


## interface MethodsInterface

```typescript
Expand All @@ -292,43 +276,38 @@ interface MethodsInterface {
<TValue>(arg: TValue): void
```

Type parameters:
**Type parameters:**

| Name |
| ------ |
| TValue |

Parameters:
**Parameters:**

| Name | Type |
| ---- | ------ |
| arg | TValue |

Return type:
**Return type:**

void

---

### Methods

```typescript
someMethod<T>(): string
```

Type parameters:
**Type parameters:**

| Name |
| ---- |
| T |

Return type:
**Return type:**

string

---


## interface MonsterInterface

<span style="color: #d2d255;">Warning: Beta!</span>
Expand All @@ -345,7 +324,7 @@ interface MonsterInterface<TValue extends Object = {}> extends ObjectsInterface
<T>(key?: string | undefined): { someProperty: T; };
<T>(key: number): { someProperty: T; };
readonly [key: string]: TValue;
readonly objectOne?: TValue;
readonly objectOne: TValue;
objectTwo: TValue;
}
```
Expand All @@ -366,96 +345,86 @@ interface MonsterInterface<TValue extends Object = {}> extends ObjectsInterface
new <T>(): MonsterInterface<T>
```

Type parameters:
**Type parameters:**

| Name |
| ---- |
| T |

Return type:
**Return type:**

[MonsterInterface][InterfaceDeclaration-12]&#60;T&#62;

---

```typescript
new (someParameter: string): string
```

Parameters:
**Parameters:**

| Name | Type |
| ------------- | ------ |
| someParameter | string |

Return type:
**Return type:**

string

---

### Call

```typescript
<T>(): { someProperty: T; }
```

Type parameters:
**Type parameters:**

| Name |
| ---- |
| T |

Return type:
**Return type:**

{ someProperty: T; }

---

```typescript
<T>(key?: string | undefined): { someProperty: T; }
```

Type parameters:
**Type parameters:**

| Name |
| ---- |
| T |

Parameters:
**Parameters:**

| Name | Type | Optional |
| ---- | ----------------------- | -------- |
| key | undefined &#124; string | Yes |

Return type:
**Return type:**

{ someProperty: T; }

---

```typescript
<T>(key: number): { someProperty: T; }
```

Type parameters:
**Type parameters:**

| Name |
| ---- |
| T |

Parameters:
**Parameters:**

| Name | Type |
| ---- | ------ |
| key | number |

Return type:
**Return type:**

{ someProperty: T; }

---

### Index signatures

```typescript
Expand All @@ -468,8 +437,6 @@ Index `key` - string

Type - TValue

---

### Properties

| Name | Type |
Expand All @@ -496,8 +463,6 @@ Index `key` - string

Type - string | number

---

```typescript
[key: number]: string
```
Expand All @@ -506,9 +471,6 @@ Index `key` - number

Type - string

---


## interface StringsDictionary

```typescript
Expand All @@ -527,9 +489,6 @@ Index `key` - string

Type - string

---


## interface MyInterface

```typescript
Expand Down
1 change: 1 addition & 0 deletions packages/ts-docs-gen/src/file-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface OutputData {

type RenderedItemList = Array<PluginResult | OutputData>;

// TODO: remove unused files before generating docs.
export class FileManager {
/**
* <FileLocation, RenderedItems>
Expand Down
7 changes: 3 additions & 4 deletions packages/ts-docs-gen/src/plugins/api-callable-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export class ApiCallablePlugin implements Plugin<CallableApiItem> {
parameters: Contracts.ApiParameterDto[],
typeParameters: Contracts.ApiTypeParameterDto[]
): string {

switch (apiItem.ApiKind) {
case Contracts.ApiItemKinds.Construct: {
return GeneratorHelpers.ApiConstructToString(typeParameters, parameters, apiItem.ReturnType);
Expand Down Expand Up @@ -58,7 +57,7 @@ export class ApiCallablePlugin implements Plugin<CallableApiItem> {
usedReferences.push(...table.References);

builder
.Text("Type parameters:")
.Bold("Type parameters:")
.EmptyLine()
.Text(table.Text)
.EmptyLine();
Expand All @@ -69,7 +68,7 @@ export class ApiCallablePlugin implements Plugin<CallableApiItem> {
usedReferences.push(...table.References);

builder
.Text("Parameters:")
.Bold("Parameters:")
.EmptyLine()
.Text(table.Text)
.EmptyLine();
Expand All @@ -79,7 +78,7 @@ export class ApiCallablePlugin implements Plugin<CallableApiItem> {
const renderedReturnType = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.ReturnType);

builder
.Text("Return type:")
.Bold("Return type:")
.EmptyLine()
.Text(renderedReturnType.Text);

Expand Down
Loading