We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 548fefd commit 52e9819Copy full SHA for 52e9819
packages/schematics/angular/utility/ast-utils.ts
@@ -191,10 +191,7 @@ export function insertAfterLastOccurrence(nodes: ts.Node[],
191
syntaxKind?: ts.SyntaxKind): Change {
192
// sort() has a side effect, so make a copy so that we won't overwrite the parent's object.
193
let lastItem = [...nodes].sort(nodesByPosition).pop();
194
- if (!lastItem) {
195
- throw new Error();
196
- }
197
- if (syntaxKind) {
+ if (syntaxKind && lastItem) {
198
lastItem = findNodes(lastItem, syntaxKind).sort(nodesByPosition).pop();
199
}
200
if (!lastItem && fallbackPos == undefined) {
0 commit comments