Skip to content

Commit 51341e0

Browse files
committed
Merge pull request #388 from zhengbli/update2for17
Update tsserver with fixes
2 parents e5c716e + 6ee65b6 commit 51341e0

File tree

2 files changed

+71
-79
lines changed

2 files changed

+71
-79
lines changed

tsserver/tsc.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,6 @@ var ts;
15341534
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." },
15351535
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." },
15361536
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
1537-
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
15381537
Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." },
15391538
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
15401539
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
@@ -4769,6 +4768,15 @@ var ts;
47694768
return !!node && (node.kind === 162 || node.kind === 161);
47704769
}
47714770
ts.isBindingPattern = isBindingPattern;
4771+
function isNodeDescendentOf(node, ancestor) {
4772+
while (node) {
4773+
if (node === ancestor)
4774+
return true;
4775+
node = node.parent;
4776+
}
4777+
return false;
4778+
}
4779+
ts.isNodeDescendentOf = isNodeDescendentOf;
47724780
function isInAmbientContext(node) {
47734781
while (node) {
47744782
if (node.flags & (2 | 8192)) {
@@ -13967,7 +13975,8 @@ var ts;
1396713975
var container = ts.getThisContainer(node, false);
1396813976
var parent = container && container.parent;
1396913977
if (parent && (ts.isClassLike(parent) || parent.kind === 215)) {
13970-
if (!(container.flags & 128)) {
13978+
if (!(container.flags & 128) &&
13979+
(container.kind !== 144 || ts.isNodeDescendentOf(node, container.body))) {
1397113980
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
1397213981
}
1397313982
}
@@ -17669,7 +17678,9 @@ var ts;
1766917678
for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {
1767017679
var element = _a[_i];
1767117680
if (element.kind !== 187) {
17672-
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
17681+
if (element.name.kind === 69) {
17682+
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
17683+
}
1767317684
assignBindingElementTypes(element);
1767417685
}
1767517686
}
@@ -19262,9 +19273,12 @@ var ts;
1926219273
if (promiseType === unknownType && compilerOptions.isolatedModules) {
1926319274
return unknownType;
1926419275
}
19265-
var promiseConstructor = getMergedSymbol(promiseType.symbol);
19276+
var promiseConstructor = getNodeLinks(node.type).resolvedSymbol;
1926619277
if (!promiseConstructor || !symbolIsValue(promiseConstructor)) {
19267-
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType));
19278+
var typeName = promiseConstructor
19279+
? symbolToString(promiseConstructor)
19280+
: typeToString(promiseType);
19281+
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName);
1926819282
return unknownType;
1926919283
}
1927019284
var promiseConstructorType = getTypeOfSymbol(promiseConstructor);
@@ -24347,16 +24361,8 @@ var ts;
2434724361
diagnostics: diagnostics,
2434824362
sourceMaps: sourceMapDataList
2434924363
};
24350-
function isNodeDescendentOf(node, ancestor) {
24351-
while (node) {
24352-
if (node === ancestor)
24353-
return true;
24354-
node = node.parent;
24355-
}
24356-
return false;
24357-
}
2435824364
function isUniqueLocalName(name, container) {
24359-
for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) {
24365+
for (var node = container; ts.isNodeDescendentOf(node, container); node = node.nextContainer) {
2436024366
if (node.locals && ts.hasProperty(node.locals, name)) {
2436124367
if (node.locals[name].flags & (107455 | 1048576 | 8388608)) {
2436224368
return false;
@@ -30524,10 +30530,6 @@ var ts;
3052430530
var start_2 = ts.getTokenPosOfNode(file.imports[i], file);
3052530531
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
3052630532
}
30527-
else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) {
30528-
var start_3 = ts.getTokenPosOfNode(file.imports[i], file);
30529-
fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition));
30530-
}
3053130533
else if (importedFile.referencedFiles.length) {
3053230534
var firstRef = importedFile.referencedFiles[0];
3053330535
fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition));

0 commit comments

Comments
 (0)