Treat multiple prototype property assignments as union property declarations

This commit is contained in:
Ryan Cavanaugh committed 2016-02-01 20:59:37 -08:00
1 parent 7259b9fd4a
commit a4c6f66686
2 files changed
+17 -1

No files matched your search

+1 -1
View File
@@ -2827,7 +2827,7 @@ namespace ts {
}
// Handle module.exports = expr
if (declaration.kind === SyntaxKind.BinaryExpression) {
return links.type = checkExpression((<BinaryExpression>declaration).right);
return links.type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right)));
}
if (declaration.kind === SyntaxKind.PropertyAccessExpression) {
// Declarations only exist for property access expressions for certain
@@ -0,0 +1,16 @@
/// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: a.js
//// function Person(age) {
//// if (age >= 18) {
//// this.canVote = true;
//// } else {
//// this.canVote = 23;
//// }
//// }
//// let x = new Person(100);
//// x.canVote/**/;
goTo.marker();
verify.quickInfoIs('(property) Person.canVote: boolean | number');