Skip to content

Commit

Permalink
fix(): fix as expression issue (plugin)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jan 28, 2020
1 parent cc93dfa commit 3f865ec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/plugin/visitors/model-class.visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,13 @@ export class ModelClassVisitor extends AbstractFileVisitor {
if (hasPropertyKey(key, existingProperties)) {
return undefined;
}
const initializer = node.initializer;
let initializer = node.initializer;
if (!initializer) {
return undefined;
}
if (ts.isAsExpression(initializer)) {
initializer = initializer.expression;
}
return ts.createPropertyAssignment(
key,
ts.createIdentifier(initializer.getText())
Expand Down

0 comments on commit 3f865ec

Please sign in to comment.