Fix #8795: make properties defined in optional constructor paramters optional

This commit is contained in:
Mohamed Hegazy
2016-05-24 20:09:15 -07:00
parent 02c584bcc6
commit 7cb2db7f9e
8 changed files with 89 additions and 45 deletions

View File

@@ -2027,7 +2027,7 @@ namespace ts {
// containing class.
if (isParameterPropertyDeclaration(node)) {
const classDeclaration = <ClassLikeDeclaration>node.parent.parent;
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property | (node.questionToken ? SymbolFlags.Optional : SymbolFlags.None), SymbolFlags.PropertyExcludes);
}
}