Skip to content

Commit 15d689c

Browse files
Simplify simplify simplify.
1 parent cf00746 commit 15d689c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Diff for: scripts/tslint/preferConstRule.ts

+4-11
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,10 @@ class PreferConstWalker extends Lint.RuleWalker {
112112
this.markAssignment((element as ts.ShorthandPropertyAssignment).name);
113113
}
114114
else if (kind === ts.SyntaxKind.PropertyAssignment) {
115-
const rhs = (element as ts.PropertyAssignment).initializer;
116-
117-
if (rhs.kind === ts.SyntaxKind.Identifier) {
118-
this.markAssignment(rhs as ts.Identifier);
119-
}
120-
else if (rhs.kind === ts.SyntaxKind.ObjectLiteralExpression || rhs.kind === ts.SyntaxKind.ArrayLiteralExpression) {
121-
this.visitBindingLiteralExpression(rhs as ts.ObjectLiteralExpression | ts.ArrayLiteralExpression);
122-
}
123-
else {
124-
// Should be an error, but do nothing for now.
125-
}
115+
this.visitLHSExpressions((element as ts.PropertyAssignment).initializer);
116+
}
117+
else {
118+
// Should we throw an exception?
126119
}
127120
}
128121
}

0 commit comments

Comments
 (0)