Skip to content

Commit

Permalink
Create API review for JS packages with namespace in api extractor mod…
Browse files Browse the repository at this point in the history
…el (#5292)
  • Loading branch information
praveenkuttappan authored Feb 1, 2023
1 parent a661266 commit 1803f5f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tools/apiview/parsers/js-api-parser/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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:
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion tools/apiview/parsers/js-api-parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure-tools/ts-genapi",
"version": "1.0.3",
"version": "1.0.4",
"description": "",
"main": "index.js",
"publishConfig": {
Expand Down
1 change: 1 addition & 0 deletions tools/apiview/parsers/js-api-parser/tokensBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class TokensBuilder
"import",
"in",
"instanceof",
"namespace",
"new",
"null",
"return",
Expand Down

0 comments on commit 1803f5f

Please sign in to comment.