Skip to content

Commit

Permalink
Use typescript 3.2.x (#922)
Browse files Browse the repository at this point in the history
* Use typescript 3.2.x
* Fix destructuring specs
  • Loading branch information
Wenzil authored and Gerrit0 committed Jan 2, 2019
1 parent 1c4c515 commit b2f4134
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 18 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -46,7 +46,7 @@
"progress": "^2.0.0",
"shelljs": "^0.8.2",
"typedoc-default-themes": "^0.5.0",
"typescript": "3.1.x"
"typescript": "3.2.x"
},
"devDependencies": {
"@types/mocha": "^5.2.4",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/converter/plugins/SourcePlugin.ts
Expand Up @@ -108,7 +108,7 @@ export class SourcePlugin extends ConverterComponent {
file.reflections.push(reflection);
}

reflection.sources!.push({
reflection.sources.push({
file: file,
fileName: fileName,
line: position.line + 1,
Expand Down
14 changes: 13 additions & 1 deletion src/lib/converter/types/tuple.ts
Expand Up @@ -17,7 +17,19 @@ export class TupleConverter extends ConverterTypeComponent implements TypeConver
* Test whether this converter can handle the given TypeScript type.
*/
supportsType(context: Context, type: ts.TypeReference): boolean {
return !!(type.objectFlags & ts.ObjectFlags.Tuple);
// If this type is a tuple
if (type.objectFlags & ts.ObjectFlags.Tuple) {
return true;
}

// If this type points to a tuple
if (type.objectFlags & ts.ObjectFlags.Reference) {
if (type.target.objectFlags & ts.ObjectFlags.Tuple) {
return true;
}
}

return false;
}

/**
Expand Down
32 changes: 22 additions & 10 deletions src/test/converter/destructuring/specs.json
Expand Up @@ -109,11 +109,17 @@
}
],
"type": {
"type": "array",
"elementType": {
"type": "intrinsic",
"name": "number"
}
"type": "tuple",
"elements": [
{
"type": "intrinsic",
"name": "number"
},
{
"type": "intrinsic",
"name": "number"
}
]
}
},
{
Expand All @@ -130,11 +136,17 @@
}
],
"type": {
"type": "array",
"elementType": {
"type": "intrinsic",
"name": "number"
}
"type": "tuple",
"elements": [
{
"type": "intrinsic",
"name": "number"
},
{
"type": "intrinsic",
"name": "number"
}
]
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/test/renderer/specs/modules/_typescript_1_5_.html
Expand Up @@ -140,7 +140,7 @@ <h3>destruct<wbr>Array<wbr>With<wbr>IgnoresA</h3>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="destructarraywithignoresrest" class="tsd-anchor"></a>
<h3>destruct<wbr>Array<wbr>With<wbr>Ignores<wbr>Rest</h3>
<div class="tsd-signature tsd-kind-icon">destruct<wbr>Array<wbr>With<wbr>Ignores<wbr>Rest<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div>
<div class="tsd-signature tsd-kind-icon">destruct<wbr>Array<wbr>With<wbr>Ignores<wbr>Rest<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/sebastian-lenz/typedoc/blob/master/examples/basic/src/typescript-1.5.ts#L20">typescript-1.5.ts:20</a></li>
Expand All @@ -150,7 +150,7 @@ <h3>destruct<wbr>Array<wbr>With<wbr>Ignores<wbr>Rest</h3>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="destructarraywithrest" class="tsd-anchor"></a>
<h3>destruct<wbr>Array<wbr>With<wbr>Rest</h3>
<div class="tsd-signature tsd-kind-icon">destruct<wbr>Array<wbr>With<wbr>Rest<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div>
<div class="tsd-signature tsd-kind-icon">destruct<wbr>Array<wbr>With<wbr>Rest<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/sebastian-lenz/typedoc/blob/master/examples/basic/src/typescript-1.5.ts#L15">typescript-1.5.ts:15</a></li>
Expand Down

0 comments on commit b2f4134

Please sign in to comment.