Skip to content

Commit c0744f0

Browse files
committed
fix(core): add '?' for optional type declarations in tables
1 parent ba8956c commit c0744f0

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'typedoc-plugin-markdown': patch
3+
---
4+
5+
- Add '?' for optional type declarations in tables

packages/typedoc-plugin-markdown/test/fixtures/src/reflections/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export type LiteralType = {
103103
/**
104104
* comment for x
105105
*/
106-
x: string;
106+
x?: string;
107107
/**
108108
* comment for y
109109
*/
@@ -115,7 +115,7 @@ export type LiteralType = {
115115
/**
116116
* comment for y.y
117117
*/
118-
y: boolean | string;
118+
y?: boolean | string;
119119
/**
120120
* comment for y.z
121121
*/

packages/typedoc-plugin-markdown/test/specs/__snapshots__/objects-and-params.spec.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,9 @@ Comments for someFunctionWithArrow
504504
505505
\`string\`
506506
507-
### x
507+
### x?
508508
509-
> **x**: \`string\`
509+
> \`optional\` **x**: \`string\`
510510
511511
comment for x
512512
@@ -522,9 +522,9 @@ comment for y
522522
523523
comment for y.x
524524
525-
### y.y
525+
### y.y?
526526
527-
> **y**: \`boolean\` \\| \`string\`
527+
> \`optional\` **y**: \`boolean\` \\| \`string\`
528528
529529
comment for y.y
530530
@@ -635,10 +635,10 @@ Comments for someFunctionWithArrow
635635
636636
\`string\`
637637
638-
### x
638+
### x?
639639
640640
\`\`\`ts
641-
x: string;
641+
optional x: string;
642642
\`\`\`
643643
644644
comment for x
@@ -663,10 +663,10 @@ x: string;
663663
664664
comment for y.x
665665
666-
### y.y
666+
### y.y?
667667
668668
\`\`\`ts
669-
y: boolean | string;
669+
optional y: boolean | string;
670670
\`\`\`
671671
672672
comment for y.y

packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.type-alias.spec.ts.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ Comments for someFunctionWithArrow
113113
114114
\`string\`
115115
116-
### x
116+
### x?
117117
118-
> **x**: \`string\`
118+
> \`optional\` **x**: \`string\`
119119
120120
comment for x
121121
@@ -131,9 +131,9 @@ comment for y
131131
132132
comment for y.x
133133
134-
### y.y
134+
### y.y?
135135
136-
> **y**: \`boolean\` \\| \`string\`
136+
> \`optional\` **y**: \`boolean\` \\| \`string\`
137137
138138
comment for y.y
139139
@@ -227,10 +227,10 @@ Comments for LiteralType
227227
| Name | Type | Description |
228228
| :------ | :------ | :------ |
229229
| \`someFunctionWithArrow\` | () => \`string\` | Comments for someFunctionWithArrow |
230-
| \`x\` | \`string\` | comment for x |
230+
| \`x\`? | \`string\` | comment for x |
231231
| \`y\` | \`object\` | comment for y |
232232
| \`y.x\` | \`string\` | comment for y.x |
233-
| \`y.y\` | \`boolean\` \\| \`string\` | comment for y.y |
233+
| \`y.y\`? | \`boolean\` \\| \`string\` | comment for y.y |
234234
| \`y.z\` | (\`x\`: \`string\`) => \`string\` | comment for y.z |
235235
| \`z\` | (\`x\`: \`string\`) => \`string\` | - |
236236
| \`get accessorA\` | [\`Promise\`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\\<\`string\`\\> | Comments for accessorA getter |

0 commit comments

Comments
 (0)