Properly display optional methods in language service

This commit is contained in:
Anders Hejlsberg 2016-05-14 13:34:54 -07:00
parent b90761cf43
commit 20e2be2d51

View file

@ -4541,8 +4541,10 @@ namespace ts {
}
// For properties, variables and local vars: show the type
// Also handle methods that have a union type (i.e. that may be undefined)
if (symbolKind === ScriptElementKind.memberVariableElement ||
symbolFlags & SymbolFlags.Variable ||
symbolFlags & SymbolFlags.Method && type.flags & TypeFlags.Union ||
symbolKind === ScriptElementKind.localVariableElement ||
isThisExpression) {
displayParts.push(punctuationPart(SyntaxKind.ColonToken));