Skip to content

Commit

Permalink
fix(plugin): fallback on errors (return unmodified node)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Feb 13, 2020
1 parent f977e54 commit e9fc22c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/plugin/visitors/model-class.visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ export class ModelClassVisitor extends AbstractFileVisitor {
if (isPropertyStatic) {
return node;
}
this.inspectPropertyDeclaration(
node,
typeChecker,
options,
sourceFile.fileName,
sourceFile
);
try {
this.inspectPropertyDeclaration(
node,
typeChecker,
options,
sourceFile.fileName,
sourceFile
);
} catch (err) {
return node;
}
return node;
}
return ts.visitEachChild(node, visitNode, ctx);
Expand Down
3 changes: 3 additions & 0 deletions test/plugin/fixtures/create-cat-alt.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export class CreateCatDto2 {
nodes: Node[]
alias: AliasedType,
numberAlias: NumberAlias,
},
prop: {
[x: string]: string;
}
}
`;
Expand Down

0 comments on commit e9fc22c

Please sign in to comment.