Skip to content

Commit 04f6556

Browse files
PajnJamesHenry
authored andcommitted
New: Mark optional parameters and properties (fixes eslint#186) (eslint#187)
1 parent cc9d4b3 commit 04f6556

8 files changed

+2130
-1
lines changed

lib/ast-converter.js

+8
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,14 @@ module.exports = function(ast, extra) {
752752
type: "Identifier",
753753
name: ts.unescapeIdentifier(node.text)
754754
});
755+
if (node.parent.questionToken && (
756+
SyntaxKind.Parameter === node.parent.kind ||
757+
SyntaxKind.PropertyDeclaration === node.parent.kind ||
758+
SyntaxKind.PropertySignature === node.parent.kind ||
759+
SyntaxKind.MethodSignature === node.parent.kind
760+
)) {
761+
result.optional = true;
762+
}
755763
break;
756764

757765
case SyntaxKind.WithStatement:

0 commit comments

Comments
 (0)