Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 3c3666c

Browse files
committed
fix(utils): assign correct type
1 parent 32ceda1 commit 3c3666c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/util/typescript-utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ObjectLiteralElement,
1515
ObjectLiteralExpression,
1616
PropertyAssignment,
17+
ArrayLiteralExpression,
1718
ScriptTarget,
1819
SourceFile,
1920
StringLiteral,
@@ -238,7 +239,8 @@ export function appendNgModuleDeclaration(filePath: string, fileContent: string,
238239
const sourceFile = getTypescriptSourceFile(filePath, fileContent, ScriptTarget.Latest, false);
239240
const decorator = getNgModuleDecorator(path.basename(filePath), sourceFile);
240241
const obj = getNgModuleObjectLiteralArg(decorator);
241-
const declarations = (findObjectLiteralElementByName(obj.properties, 'declarations') as PropertyAssignment).initializer.elements;
242+
const properties = (findObjectLiteralElementByName(obj.properties, 'declarations') as PropertyAssignment);
243+
const declarations = (properties.initializer as ArrayLiteralExpression).elements;
242244
return appendAfter(fileContent, declarations[declarations.length - 1], `,\n ${declaration}`);
243245
}
244246

0 commit comments

Comments
 (0)