mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Completion entry details of union of methods with no call signature
Fixes #928
This commit is contained in:
parent
3c2f556306
commit
c8dc2bdef0
@ -2764,7 +2764,8 @@ module ts {
|
||||
|
||||
if (flags & SymbolFlags.Property) {
|
||||
if (flags & SymbolFlags.UnionProperty) {
|
||||
return forEach(typeInfoResolver.getRootSymbols(symbol), rootSymbol => {
|
||||
// If any of the property includes the declaration of property - the kind is property
|
||||
var unionPropetyKind = forEach(typeInfoResolver.getRootSymbols(symbol), rootSymbol => {
|
||||
var rootSymbolFlags = rootSymbol.getFlags();
|
||||
if (rootSymbolFlags & SymbolFlags.Property) {
|
||||
return ScriptElementKind.memberVariableElement;
|
||||
@ -2772,7 +2773,16 @@ module ts {
|
||||
if (rootSymbolFlags & SymbolFlags.GetAccessor) return ScriptElementKind.memberVariableElement;
|
||||
if (rootSymbolFlags & SymbolFlags.SetAccessor) return ScriptElementKind.memberVariableElement;
|
||||
Debug.assert((rootSymbolFlags & SymbolFlags.Method) !== undefined);
|
||||
}) || ScriptElementKind.memberFunctionElement;
|
||||
});
|
||||
if (!unionPropetyKind) {
|
||||
// If this was union of all methods, make sure it has call signatures before we call it method
|
||||
var typeOfUnionProperty = typeInfoResolver.getTypeOfSymbol(symbol);
|
||||
if (typeOfUnionProperty.getCallSignatures().length) {
|
||||
return ScriptElementKind.memberFunctionElement;
|
||||
}
|
||||
return ScriptElementKind.memberVariableElement;
|
||||
}
|
||||
return unionPropetyKind;
|
||||
}
|
||||
return ScriptElementKind.memberVariableElement;
|
||||
}
|
||||
|
||||
8
tests/cases/fourslash/completionEntryForUnionMethod.ts
Normal file
8
tests/cases/fourslash/completionEntryForUnionMethod.ts
Normal file
@ -0,0 +1,8 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
////var y: Array<string>|Array<number>;
|
||||
////y.map/**/(
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs("(property) map: (<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | (<U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[])");
|
||||
verify.completionListContains('map', "(property) map: (<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | (<U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[])");
|
||||
Loading…
x
Reference in New Issue
Block a user