mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Treat multiple prototype property assignments as union property declarations
(cherry picked from commit a4c6f66686)
This commit is contained in:
committed by
Bill Ticehurst
parent
5de87e30c6
commit
671d83e81a
@@ -2845,7 +2845,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');
|
||||
Reference in New Issue
Block a user