aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-03 23:50:58 +0800
committerFabio Berger <me@fabioberger.com>2018-03-03 23:50:58 +0800
commit9e7b45ea4cf8d0fabec5f293efc448262e0a7cb2 (patch)
tree46af50d0ba08d4a31911a454c0f6493e8f955377 /packages/website/ts/utils
parent6c6bd60a483220706bdecf31b1eef3dc637fade9 (diff)
downloaddexon-sol-tools-9e7b45ea4cf8d0fabec5f293efc448262e0a7cb2.tar
dexon-sol-tools-9e7b45ea4cf8d0fabec5f293efc448262e0a7cb2.tar.gz
dexon-sol-tools-9e7b45ea4cf8d0fabec5f293efc448262e0a7cb2.tar.bz2
dexon-sol-tools-9e7b45ea4cf8d0fabec5f293efc448262e0a7cb2.tar.lz
dexon-sol-tools-9e7b45ea4cf8d0fabec5f293efc448262e0a7cb2.tar.xz
dexon-sol-tools-9e7b45ea4cf8d0fabec5f293efc448262e0a7cb2.tar.zst
dexon-sol-tools-9e7b45ea4cf8d0fabec5f293efc448262e0a7cb2.zip
Add support for backward compatibility for TypeDoc versions <0.9.0
Diffstat (limited to 'packages/website/ts/utils')
-rw-r--r--packages/website/ts/utils/typedoc_utils.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/website/ts/utils/typedoc_utils.ts b/packages/website/ts/utils/typedoc_utils.ts
index 992475911..0f79410ae 100644
--- a/packages/website/ts/utils/typedoc_utils.ts
+++ b/packages/website/ts/utils/typedoc_utils.ts
@@ -170,8 +170,16 @@ export const typeDocUtils = {
const methodIfExists = !_.isUndefined(entity.declaration)
? typeDocUtils._convertMethod(entity.declaration, isConstructor, sections, sectionName, docId)
: undefined;
- const indexSignatureIfExists = !_.isUndefined(entity.indexSignature)
- ? typeDocUtils._convertIndexSignature(entity.indexSignature[0], sections, sectionName, docId)
+ const doesIndexSignatureExist = !_.isUndefined(entity.indexSignature);
+ const isIndexSignatureArray = _.isArray(entity.indexSignature);
+ // HACK: TypeDoc Versions <0.9.0 indexSignature is of type TypeDocNode[]
+ // Versions >0.9.0 have it as type TypeDocNode
+ const indexSignature =
+ doesIndexSignatureExist && isIndexSignatureArray
+ ? ((entity.indexSignature as TypeDocNode[])[0] as TypeDocNode)
+ : (entity.indexSignature as TypeDocNode);
+ const indexSignatureIfExists = doesIndexSignatureExist
+ ? typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId)
: undefined;
const commentIfExists =
!_.isUndefined(entity.comment) && !_.isUndefined(entity.comment.shortText)