Skip to content

Commit

Permalink
fix: NamespaceDeclaration#getDeclarationKindKeyword should never retu…
Browse files Browse the repository at this point in the history
…rn undefined.
  • Loading branch information
dsherret committed Jul 2, 2018
1 parent d1ee709 commit 0b81c00
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/compiler/namespace/NamespaceDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ export class NamespaceDeclaration extends NamespaceDeclarationBase<ts.NamespaceD
return this;

const declarationKindKeyword = this.getDeclarationKindKeyword();
/* istanbul ignore if */
if (declarationKindKeyword == null)
throw new errors.NotImplementedError("Expected the declaration kind keyword to exist on a namespace.");

replaceNodeText({
sourceFile: this.getSourceFile(),
Expand All @@ -127,8 +124,12 @@ export class NamespaceDeclaration extends NamespaceDeclarationBase<ts.NamespaceD
* Gets the namespace or module keyword.
*/
getDeclarationKindKeyword() {
return this.getFirstChild(child =>
const keyword = this.getFirstChild(child =>
child.getKind() === SyntaxKind.NamespaceKeyword ||
child.getKind() === SyntaxKind.ModuleKeyword);
/* istanbul ignore if */
if (keyword == null)
throw new errors.NotImplementedError("Expected the declaration kind keyword to exist on a namespace.");
return keyword;
}
}

0 comments on commit 0b81c00

Please sign in to comment.