Test for isNewIdentifierLocation, and make true for type with index signature (#22910)

This commit is contained in:
Andy authored and GitHub committed 2018-03-27 13:05:41 -07:00
1 parent ccd6a010e0
commit 21cd68dd04
19 files changed
+35 -32

No files matched your search

+2 -2
View File
@@ -840,8 +840,8 @@ namespace FourSlash {
this.raiseError(`No completions at position '${this.currentCaretPosition}'.`);
}
if (options && options.isNewIdentifierLocation !== undefined && actualCompletions.isNewIdentifierLocation !== options.isNewIdentifierLocation) {
this.raiseError(`Expected 'isNewIdentifierLocation' to be ${options.isNewIdentifierLocation}, got ${actualCompletions.isNewIdentifierLocation}`);
if (actualCompletions.isNewIdentifierLocation !== (options && options.isNewIdentifierLocation || false)) {
this.raiseError(`Expected 'isNewIdentifierLocation' to be ${options && options.isNewIdentifierLocation}, got ${actualCompletions.isNewIdentifierLocation}`);
}
const actual = actualCompletions.entries;
+2
View File
@@ -1031,6 +1031,8 @@ namespace ts.Completions {
}
function addTypeProperties(type: Type): void {
isNewIdentifierLocation = !!type.getStringIndexType() || !!type.getNumberIndexType();
if (isSourceFileJavaScript(sourceFile)) {
// In javascript files, for union types, we don't just get the members that
// the individual types have in common, we also include all the members that