diff --git a/tools/apiview/parsers/js-api-parser/export.ts b/tools/apiview/parsers/js-api-parser/export.ts index c4d5c161614..fc41f9c290e 100644 --- a/tools/apiview/parsers/js-api-parser/export.ts +++ b/tools/apiview/parsers/js-api-parser/export.ts @@ -16,6 +16,9 @@ function appendMembers(builder: TokensBuilder, navigation: IApiViewNavItem[], it builder.lineId(item.canonicalReference.toString()); builder.indent(); if (item instanceof ApiDeclaredItem) { + if ( item.kind === ApiItemKind.Namespace) { + builder.splitAppend(`declare namespace ${item.displayName} `, item.canonicalReference.toString(), item.displayName); + } for (const token of item.excerptTokens) { if (token.kind === ExcerptTokenKind.Reference) { @@ -35,6 +38,7 @@ function appendMembers(builder: TokensBuilder, navigation: IApiViewNavItem[], it { case ApiItemKind.Interface: case ApiItemKind.Class: + case ApiItemKind.Namespace: typeKind = item.kind.toLowerCase(); break case ApiItemKind.TypeAlias: @@ -56,7 +60,8 @@ function appendMembers(builder: TokensBuilder, navigation: IApiViewNavItem[], it } if (item.kind === ApiItemKind.Interface || - item.kind === ApiItemKind.Class) + item.kind === ApiItemKind.Class || + item.kind === ApiItemKind.Namespace) { if (item.members.length > 0) { diff --git a/tools/apiview/parsers/js-api-parser/package.json b/tools/apiview/parsers/js-api-parser/package.json index ac224a723e3..6b21bf4748d 100644 --- a/tools/apiview/parsers/js-api-parser/package.json +++ b/tools/apiview/parsers/js-api-parser/package.json @@ -1,6 +1,6 @@ { "name": "@azure-tools/ts-genapi", - "version": "1.0.3", + "version": "1.0.4", "description": "", "main": "index.js", "publishConfig": { diff --git a/tools/apiview/parsers/js-api-parser/tokensBuilder.ts b/tools/apiview/parsers/js-api-parser/tokensBuilder.ts index 79cde402f63..16de467e4a7 100644 --- a/tools/apiview/parsers/js-api-parser/tokensBuilder.ts +++ b/tools/apiview/parsers/js-api-parser/tokensBuilder.ts @@ -30,6 +30,7 @@ export class TokensBuilder "import", "in", "instanceof", + "namespace", "new", "null", "return",