typescript 5.0.0-dev.20230131 → 5.0.0-dev.20230202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.d.ts +0 -2
- package/lib/lib.decorators.d.ts +0 -2
- package/lib/lib.decorators.legacy.d.ts +0 -2
- package/lib/lib.dom.d.ts +0 -2
- package/lib/lib.dom.iterable.d.ts +0 -2
- package/lib/lib.es2015.collection.d.ts +0 -2
- package/lib/lib.es2015.core.d.ts +0 -2
- package/lib/lib.es2015.d.ts +0 -2
- package/lib/lib.es2015.generator.d.ts +0 -2
- package/lib/lib.es2015.iterable.d.ts +0 -2
- package/lib/lib.es2015.promise.d.ts +0 -2
- package/lib/lib.es2015.proxy.d.ts +0 -2
- package/lib/lib.es2015.reflect.d.ts +0 -2
- package/lib/lib.es2015.symbol.d.ts +0 -2
- package/lib/lib.es2015.symbol.wellknown.d.ts +0 -2
- package/lib/lib.es2016.array.include.d.ts +0 -2
- package/lib/lib.es2016.d.ts +0 -2
- package/lib/lib.es2016.full.d.ts +0 -2
- package/lib/lib.es2017.d.ts +0 -2
- package/lib/lib.es2017.full.d.ts +0 -2
- package/lib/lib.es2017.intl.d.ts +0 -2
- package/lib/lib.es2017.object.d.ts +0 -2
- package/lib/lib.es2017.sharedmemory.d.ts +0 -2
- package/lib/lib.es2017.string.d.ts +0 -2
- package/lib/lib.es2017.typedarrays.d.ts +0 -2
- package/lib/lib.es2018.asyncgenerator.d.ts +0 -2
- package/lib/lib.es2018.asynciterable.d.ts +0 -2
- package/lib/lib.es2018.d.ts +0 -2
- package/lib/lib.es2018.full.d.ts +0 -2
- package/lib/lib.es2018.intl.d.ts +0 -2
- package/lib/lib.es2018.promise.d.ts +0 -2
- package/lib/lib.es2018.regexp.d.ts +0 -2
- package/lib/lib.es2019.array.d.ts +0 -2
- package/lib/lib.es2019.d.ts +0 -2
- package/lib/lib.es2019.full.d.ts +0 -2
- package/lib/lib.es2019.intl.d.ts +0 -2
- package/lib/lib.es2019.object.d.ts +0 -2
- package/lib/lib.es2019.string.d.ts +0 -2
- package/lib/lib.es2019.symbol.d.ts +0 -2
- package/lib/lib.es2020.bigint.d.ts +0 -2
- package/lib/lib.es2020.d.ts +0 -2
- package/lib/lib.es2020.date.d.ts +0 -2
- package/lib/lib.es2020.full.d.ts +0 -2
- package/lib/lib.es2020.intl.d.ts +0 -2
- package/lib/lib.es2020.number.d.ts +0 -2
- package/lib/lib.es2020.promise.d.ts +0 -2
- package/lib/lib.es2020.sharedmemory.d.ts +0 -2
- package/lib/lib.es2020.string.d.ts +0 -2
- package/lib/lib.es2020.symbol.wellknown.d.ts +0 -2
- package/lib/lib.es2021.d.ts +0 -2
- package/lib/lib.es2021.full.d.ts +0 -2
- package/lib/lib.es2021.intl.d.ts +0 -2
- package/lib/lib.es2021.promise.d.ts +0 -2
- package/lib/lib.es2021.string.d.ts +0 -2
- package/lib/lib.es2021.weakref.d.ts +0 -2
- package/lib/lib.es2022.array.d.ts +0 -2
- package/lib/lib.es2022.d.ts +0 -2
- package/lib/lib.es2022.error.d.ts +0 -2
- package/lib/lib.es2022.full.d.ts +0 -2
- package/lib/lib.es2022.intl.d.ts +0 -2
- package/lib/lib.es2022.object.d.ts +0 -2
- package/lib/lib.es2022.regexp.d.ts +0 -2
- package/lib/lib.es2022.sharedmemory.d.ts +0 -2
- package/lib/lib.es2022.string.d.ts +0 -2
- package/lib/lib.es2023.array.d.ts +0 -2
- package/lib/lib.es2023.d.ts +0 -2
- package/lib/lib.es2023.full.d.ts +0 -2
- package/lib/lib.es5.d.ts +0 -2
- package/lib/lib.es6.d.ts +0 -2
- package/lib/lib.esnext.d.ts +0 -2
- package/lib/lib.esnext.full.d.ts +0 -2
- package/lib/lib.esnext.intl.d.ts +0 -2
- package/lib/lib.scripthost.d.ts +0 -2
- package/lib/lib.webworker.d.ts +0 -2
- package/lib/lib.webworker.importscripts.d.ts +0 -2
- package/lib/lib.webworker.iterable.d.ts +0 -2
- package/lib/tsc.js +43 -23
- package/lib/tsserver.js +55 -29
- package/lib/tsserverlibrary.d.ts +16 -0
- package/lib/tsserverlibrary.js +55 -29
- package/lib/typescript.d.ts +16 -0
- package/lib/typescript.js +55 -29
- package/lib/typingsInstaller.js +5 -4
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -2378,7 +2378,7 @@ __export(ts_server_exports3, {
|
|
|
2378
2378
|
|
|
2379
2379
|
// src/compiler/corePublic.ts
|
|
2380
2380
|
var versionMajorMinor = "5.0";
|
|
2381
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2381
|
+
var version = `${versionMajorMinor}.0-dev.20230202`;
|
|
2382
2382
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2383
2383
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2384
2384
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9606,7 +9606,6 @@ var Diagnostics = {
|
|
|
9606
9606
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* Error */, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
|
9607
9607
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* Error */, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
|
9608
9608
|
Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
|
|
9609
|
-
Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
9610
9609
|
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* Error */, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
|
|
9611
9610
|
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
9612
9611
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
|
@@ -10252,7 +10251,7 @@ var Diagnostics = {
|
|
|
10252
10251
|
Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
|
|
10253
10252
|
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
|
|
10254
10253
|
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
|
|
10255
|
-
|
|
10254
|
+
Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
|
|
10256
10255
|
Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
|
|
10257
10256
|
Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
|
|
10258
10257
|
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
|
|
@@ -10990,6 +10989,7 @@ var Diagnostics = {
|
|
|
10990
10989
|
new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, 1 /* Error */, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),
|
|
10991
10990
|
_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, 1 /* Error */, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),
|
|
10992
10991
|
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, 1 /* Error */, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),
|
|
10992
|
+
This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation: diag(7012, 1 /* Error */, "This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation_7012", "This overload implicitly returns the type '{0}' because it lacks a return type annotation."),
|
|
10993
10993
|
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, 1 /* Error */, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),
|
|
10994
10994
|
Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7014, 1 /* Error */, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),
|
|
10995
10995
|
Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, 1 /* Error */, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."),
|
|
@@ -20681,7 +20681,7 @@ function rangeOfNode(node) {
|
|
|
20681
20681
|
}
|
|
20682
20682
|
function rangeOfTypeParameters(sourceFile, typeParameters) {
|
|
20683
20683
|
const pos = typeParameters.pos - 1;
|
|
20684
|
-
const end = skipTrivia(sourceFile.text, typeParameters.end) + 1;
|
|
20684
|
+
const end = Math.min(sourceFile.text.length, skipTrivia(sourceFile.text, typeParameters.end) + 1);
|
|
20685
20685
|
return { pos, end };
|
|
20686
20686
|
}
|
|
20687
20687
|
function skipTypeChecking(sourceFile, options, host) {
|
|
@@ -32977,6 +32977,7 @@ var Parser;
|
|
|
32977
32977
|
switch (fourth) {
|
|
32978
32978
|
case 63 /* EqualsToken */:
|
|
32979
32979
|
case 31 /* GreaterThanToken */:
|
|
32980
|
+
case 43 /* SlashToken */:
|
|
32980
32981
|
return false;
|
|
32981
32982
|
default:
|
|
32982
32983
|
return true;
|
|
@@ -34031,7 +34032,7 @@ var Parser;
|
|
|
34031
34032
|
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
34032
34033
|
const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
|
|
34033
34034
|
if (token() === 63 /* EqualsToken */) {
|
|
34034
|
-
parseErrorAtCurrentToken(Diagnostics.
|
|
34035
|
+
parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
|
|
34035
34036
|
nextToken();
|
|
34036
34037
|
}
|
|
34037
34038
|
return result;
|
|
@@ -46489,8 +46490,10 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
46489
46490
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
46490
46491
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
46491
46492
|
if (getResolvePackageJsonExports(options)) {
|
|
46493
|
+
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
46494
|
+
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
46492
46495
|
const conditions = getConditions(options, importMode === 99 /* ESNext */);
|
|
46493
|
-
const fromExports = packageJsonContent.exports
|
|
46496
|
+
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
46494
46497
|
if (fromExports) {
|
|
46495
46498
|
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
|
|
46496
46499
|
return { ...withJsExtension, verbatimFromExports: true };
|
|
@@ -58251,6 +58254,12 @@ function createTypeChecker(host) {
|
|
|
58251
58254
|
thisParameter = getAnnotatedAccessorThisParameter(other);
|
|
58252
58255
|
}
|
|
58253
58256
|
}
|
|
58257
|
+
if (isInJSFile(declaration)) {
|
|
58258
|
+
const thisTag = getJSDocThisTag(declaration);
|
|
58259
|
+
if (thisTag && thisTag.typeExpression) {
|
|
58260
|
+
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
58261
|
+
}
|
|
58262
|
+
}
|
|
58254
58263
|
const classType = declaration.kind === 173 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : void 0;
|
|
58255
58264
|
const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
|
|
58256
58265
|
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
|
|
@@ -58364,7 +58373,11 @@ function createTypeChecker(host) {
|
|
|
58364
58373
|
if (node.tags) {
|
|
58365
58374
|
for (const tag of node.tags) {
|
|
58366
58375
|
if (isJSDocOverloadTag(tag)) {
|
|
58367
|
-
|
|
58376
|
+
const jsDocSignature = tag.typeExpression;
|
|
58377
|
+
if (jsDocSignature.type === void 0) {
|
|
58378
|
+
reportImplicitAny(jsDocSignature, anyType);
|
|
58379
|
+
}
|
|
58380
|
+
result.push(getSignatureFromDeclaration(jsDocSignature));
|
|
58368
58381
|
hasJSDocOverloads = true;
|
|
58369
58382
|
}
|
|
58370
58383
|
}
|
|
@@ -60063,7 +60076,7 @@ function createTypeChecker(host) {
|
|
|
60063
60076
|
function typePredicateKindsMatch(a, b) {
|
|
60064
60077
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
60065
60078
|
}
|
|
60066
|
-
function getUnionTypeFromSortedList(types,
|
|
60079
|
+
function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
|
|
60067
60080
|
if (types.length === 0) {
|
|
60068
60081
|
return neverType;
|
|
60069
60082
|
}
|
|
@@ -60075,7 +60088,7 @@ function createTypeChecker(host) {
|
|
|
60075
60088
|
let type = unionTypes.get(id);
|
|
60076
60089
|
if (!type) {
|
|
60077
60090
|
type = createType(1048576 /* Union */);
|
|
60078
|
-
type.objectFlags =
|
|
60091
|
+
type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
|
|
60079
60092
|
types,
|
|
60080
60093
|
/*excludeKinds*/
|
|
60081
60094
|
98304 /* Nullable */
|
|
@@ -61252,11 +61265,6 @@ function createTypeChecker(host) {
|
|
|
61252
61265
|
var _a2;
|
|
61253
61266
|
const links = getNodeLinks(node);
|
|
61254
61267
|
if (!links.resolvedType) {
|
|
61255
|
-
if (node.isTypeOf && node.typeArguments) {
|
|
61256
|
-
error(node, Diagnostics.Type_arguments_cannot_be_used_here);
|
|
61257
|
-
links.resolvedSymbol = unknownSymbol;
|
|
61258
|
-
return links.resolvedType = errorType;
|
|
61259
|
-
}
|
|
61260
61268
|
if (!isLiteralImportTypeNode(node)) {
|
|
61261
61269
|
error(node.argument, Diagnostics.String_literal_expected);
|
|
61262
61270
|
links.resolvedSymbol = unknownSymbol;
|
|
@@ -61317,7 +61325,7 @@ function createTypeChecker(host) {
|
|
|
61317
61325
|
const resolvedSymbol = resolveSymbol(symbol);
|
|
61318
61326
|
links.resolvedSymbol = resolvedSymbol;
|
|
61319
61327
|
if (meaning === 111551 /* Value */) {
|
|
61320
|
-
return getTypeOfSymbol(symbol);
|
|
61328
|
+
return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
|
|
61321
61329
|
} else {
|
|
61322
61330
|
const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
|
|
61323
61331
|
const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
|
|
@@ -63395,7 +63403,8 @@ function createTypeChecker(host) {
|
|
|
63395
63403
|
Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
|
|
63396
63404
|
generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
|
|
63397
63405
|
}
|
|
63398
|
-
|
|
63406
|
+
const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
|
|
63407
|
+
if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
|
|
63399
63408
|
const constraint = getBaseConstraintOfType(target2);
|
|
63400
63409
|
let needsOriginalSource;
|
|
63401
63410
|
if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
|
|
@@ -66313,6 +66322,11 @@ function createTypeChecker(host) {
|
|
|
66313
66322
|
case 320 /* JSDocFunctionType */:
|
|
66314
66323
|
error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
66315
66324
|
return;
|
|
66325
|
+
case 326 /* JSDocSignature */:
|
|
66326
|
+
if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
|
|
66327
|
+
error(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
|
|
66328
|
+
}
|
|
66329
|
+
return;
|
|
66316
66330
|
case 259 /* FunctionDeclaration */:
|
|
66317
66331
|
case 171 /* MethodDeclaration */:
|
|
66318
66332
|
case 170 /* MethodSignature */:
|
|
@@ -68058,7 +68072,7 @@ function createTypeChecker(host) {
|
|
|
68058
68072
|
}
|
|
68059
68073
|
return getUnionTypeFromSortedList(
|
|
68060
68074
|
filtered,
|
|
68061
|
-
type.objectFlags,
|
|
68075
|
+
type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
|
|
68062
68076
|
/*aliasSymbol*/
|
|
68063
68077
|
void 0,
|
|
68064
68078
|
/*aliasTypeArguments*/
|
|
@@ -69400,7 +69414,7 @@ function createTypeChecker(host) {
|
|
|
69400
69414
|
}
|
|
69401
69415
|
}
|
|
69402
69416
|
function getTypeOfSymbolAtLocation(symbol, location) {
|
|
69403
|
-
symbol = symbol
|
|
69417
|
+
symbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69404
69418
|
if (location.kind === 79 /* Identifier */ || location.kind === 80 /* PrivateIdentifier */) {
|
|
69405
69419
|
if (isRightSideOfQualifiedNameOrPropertyAccess(location)) {
|
|
69406
69420
|
location = location.parent;
|
|
@@ -75040,6 +75054,9 @@ function createTypeChecker(host) {
|
|
|
75040
75054
|
checkGrammarExpressionWithTypeArguments(node);
|
|
75041
75055
|
forEach(node.typeArguments, checkSourceElement);
|
|
75042
75056
|
const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
75057
|
+
return getInstantiationExpressionType(exprType, node);
|
|
75058
|
+
}
|
|
75059
|
+
function getInstantiationExpressionType(exprType, node) {
|
|
75043
75060
|
const typeArguments = node.typeArguments;
|
|
75044
75061
|
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
|
|
75045
75062
|
return exprType;
|
|
@@ -77678,7 +77695,7 @@ function createTypeChecker(host) {
|
|
|
77678
77695
|
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
|
|
77679
77696
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
77680
77697
|
return getTypeFromTypeNode(expr.type);
|
|
77681
|
-
} else if (node
|
|
77698
|
+
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
|
|
77682
77699
|
return checkExpression(node);
|
|
77683
77700
|
}
|
|
77684
77701
|
return void 0;
|
|
@@ -83591,7 +83608,7 @@ function createTypeChecker(host) {
|
|
|
83591
83608
|
}
|
|
83592
83609
|
return node.parent.kind === 180 /* TypeReference */;
|
|
83593
83610
|
}
|
|
83594
|
-
function
|
|
83611
|
+
function isInNameOfExpressionWithTypeArguments(node) {
|
|
83595
83612
|
while (node.parent.kind === 208 /* PropertyAccessExpression */) {
|
|
83596
83613
|
node = node.parent;
|
|
83597
83614
|
}
|
|
@@ -83701,10 +83718,10 @@ function createTypeChecker(host) {
|
|
|
83701
83718
|
while (isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(name)) {
|
|
83702
83719
|
name = name.parent;
|
|
83703
83720
|
}
|
|
83704
|
-
if (
|
|
83721
|
+
if (isInNameOfExpressionWithTypeArguments(name)) {
|
|
83705
83722
|
let meaning = 0 /* None */;
|
|
83706
83723
|
if (name.parent.kind === 230 /* ExpressionWithTypeArguments */) {
|
|
83707
|
-
meaning = 788968 /* Type */;
|
|
83724
|
+
meaning = isPartOfTypeNode(name) ? 788968 /* Type */ : 111551 /* Value */;
|
|
83708
83725
|
if (isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) {
|
|
83709
83726
|
meaning |= 111551 /* Value */;
|
|
83710
83727
|
}
|
|
@@ -108703,7 +108720,7 @@ function transformDeclarations(context) {
|
|
|
108703
108720
|
if (elem.kind === 229 /* OmittedExpression */) {
|
|
108704
108721
|
return elem;
|
|
108705
108722
|
}
|
|
108706
|
-
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
|
|
108723
|
+
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
|
|
108707
108724
|
return factory2.updateBindingElement(
|
|
108708
108725
|
elem,
|
|
108709
108726
|
elem.dotDotDotToken,
|
|
@@ -130627,7 +130644,7 @@ function getModuleSpecifierResolverHost(program, host) {
|
|
|
130627
130644
|
};
|
|
130628
130645
|
}
|
|
130629
130646
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
130630
|
-
return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */;
|
|
130647
|
+
return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
130631
130648
|
}
|
|
130632
130649
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
130633
130650
|
return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : void 0;
|
|
@@ -153634,12 +153651,12 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, comp
|
|
|
153634
153651
|
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
|
|
153635
153652
|
const scriptPath = sourceFile.path;
|
|
153636
153653
|
const scriptDirectory = getDirectoryPath(scriptPath);
|
|
153637
|
-
const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
|
|
153654
|
+
const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, typeChecker, preferences, mode);
|
|
153638
153655
|
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
|
|
153639
153656
|
}
|
|
153640
|
-
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
|
|
153657
|
+
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
|
|
153641
153658
|
return {
|
|
153642
|
-
extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
|
|
153659
|
+
extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
|
|
153643
153660
|
referenceKind,
|
|
153644
153661
|
importingSourceFile,
|
|
153645
153662
|
endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
|
|
@@ -153669,8 +153686,17 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
|
|
|
153669
153686
|
).values());
|
|
153670
153687
|
}
|
|
153671
153688
|
}
|
|
153672
|
-
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
153673
|
-
const
|
|
153689
|
+
function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
|
|
153690
|
+
const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
|
|
153691
|
+
typeChecker.getAmbientModules(),
|
|
153692
|
+
(module2) => {
|
|
153693
|
+
const name = module2.name.slice(1, -1);
|
|
153694
|
+
if (!name.startsWith("*.") || name.includes("/"))
|
|
153695
|
+
return;
|
|
153696
|
+
return name.slice(1);
|
|
153697
|
+
}
|
|
153698
|
+
);
|
|
153699
|
+
const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
|
|
153674
153700
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
153675
153701
|
return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
|
|
153676
153702
|
}
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -6310,6 +6310,7 @@ declare namespace ts {
|
|
|
6310
6310
|
}
|
|
6311
6311
|
interface TypeChecker {
|
|
6312
6312
|
getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
|
|
6313
|
+
getTypeOfSymbol(symbol: Symbol): Type;
|
|
6313
6314
|
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
|
|
6314
6315
|
getPropertiesOfType(type: Type): Symbol[];
|
|
6315
6316
|
getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
|
|
@@ -6400,6 +6401,21 @@ declare namespace ts {
|
|
|
6400
6401
|
getApparentType(type: Type): Type;
|
|
6401
6402
|
getBaseConstraintOfType(type: Type): Type | undefined;
|
|
6402
6403
|
getDefaultFromTypeParameter(type: Type): Type | undefined;
|
|
6404
|
+
/**
|
|
6405
|
+
* True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts.
|
|
6406
|
+
* This function will _not_ return true if passed a type which
|
|
6407
|
+
* extends `Array` (for example, the TypeScript AST's `NodeArray` type).
|
|
6408
|
+
*/
|
|
6409
|
+
isArrayType(type: Type): boolean;
|
|
6410
|
+
/**
|
|
6411
|
+
* True if this type is a tuple type. This function will _not_ return true if
|
|
6412
|
+
* passed a type which extends from a tuple.
|
|
6413
|
+
*/
|
|
6414
|
+
isTupleType(type: Type): boolean;
|
|
6415
|
+
/**
|
|
6416
|
+
* True if this type is assignable to `ReadonlyArray<any>`.
|
|
6417
|
+
*/
|
|
6418
|
+
isArrayLikeType(type: Type): boolean;
|
|
6403
6419
|
getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
|
|
6404
6420
|
/**
|
|
6405
6421
|
* Depending on the operation performed, it may be appropriate to throw away the checker
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230202`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7338,7 +7338,6 @@ ${lanes.join("\n")}
|
|
|
7338
7338
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* Error */, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
|
7339
7339
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* Error */, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
|
7340
7340
|
Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
|
|
7341
|
-
Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
7342
7341
|
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* Error */, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
|
|
7343
7342
|
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
7344
7343
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
|
@@ -7984,7 +7983,7 @@ ${lanes.join("\n")}
|
|
|
7984
7983
|
Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
|
|
7985
7984
|
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
|
|
7986
7985
|
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
|
|
7987
|
-
|
|
7986
|
+
Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
|
|
7988
7987
|
Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
|
|
7989
7988
|
Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
|
|
7990
7989
|
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
|
|
@@ -8722,6 +8721,7 @@ ${lanes.join("\n")}
|
|
|
8722
8721
|
new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, 1 /* Error */, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),
|
|
8723
8722
|
_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, 1 /* Error */, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),
|
|
8724
8723
|
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, 1 /* Error */, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),
|
|
8724
|
+
This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation: diag(7012, 1 /* Error */, "This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation_7012", "This overload implicitly returns the type '{0}' because it lacks a return type annotation."),
|
|
8725
8725
|
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, 1 /* Error */, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),
|
|
8726
8726
|
Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7014, 1 /* Error */, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),
|
|
8727
8727
|
Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, 1 /* Error */, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."),
|
|
@@ -18251,7 +18251,7 @@ ${lanes.join("\n")}
|
|
|
18251
18251
|
}
|
|
18252
18252
|
function rangeOfTypeParameters(sourceFile, typeParameters) {
|
|
18253
18253
|
const pos = typeParameters.pos - 1;
|
|
18254
|
-
const end = skipTrivia(sourceFile.text, typeParameters.end) + 1;
|
|
18254
|
+
const end = Math.min(sourceFile.text.length, skipTrivia(sourceFile.text, typeParameters.end) + 1);
|
|
18255
18255
|
return { pos, end };
|
|
18256
18256
|
}
|
|
18257
18257
|
function skipTypeChecking(sourceFile, options, host) {
|
|
@@ -30997,6 +30997,7 @@ ${lanes.join("\n")}
|
|
|
30997
30997
|
switch (fourth) {
|
|
30998
30998
|
case 63 /* EqualsToken */:
|
|
30999
30999
|
case 31 /* GreaterThanToken */:
|
|
31000
|
+
case 43 /* SlashToken */:
|
|
31000
31001
|
return false;
|
|
31001
31002
|
default:
|
|
31002
31003
|
return true;
|
|
@@ -32051,7 +32052,7 @@ ${lanes.join("\n")}
|
|
|
32051
32052
|
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
32052
32053
|
const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
|
|
32053
32054
|
if (token() === 63 /* EqualsToken */) {
|
|
32054
|
-
parseErrorAtCurrentToken(Diagnostics.
|
|
32055
|
+
parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
|
|
32055
32056
|
nextToken();
|
|
32056
32057
|
}
|
|
32057
32058
|
return result;
|
|
@@ -44305,8 +44306,10 @@ ${lanes.join("\n")}
|
|
|
44305
44306
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
44306
44307
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
44307
44308
|
if (getResolvePackageJsonExports(options)) {
|
|
44309
|
+
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
44310
|
+
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
44308
44311
|
const conditions = getConditions(options, importMode === 99 /* ESNext */);
|
|
44309
|
-
const fromExports = packageJsonContent.exports
|
|
44312
|
+
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
44310
44313
|
if (fromExports) {
|
|
44311
44314
|
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
|
|
44312
44315
|
return { ...withJsExtension, verbatimFromExports: true };
|
|
@@ -55970,6 +55973,12 @@ ${lanes.join("\n")}
|
|
|
55970
55973
|
thisParameter = getAnnotatedAccessorThisParameter(other);
|
|
55971
55974
|
}
|
|
55972
55975
|
}
|
|
55976
|
+
if (isInJSFile(declaration)) {
|
|
55977
|
+
const thisTag = getJSDocThisTag(declaration);
|
|
55978
|
+
if (thisTag && thisTag.typeExpression) {
|
|
55979
|
+
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
55980
|
+
}
|
|
55981
|
+
}
|
|
55973
55982
|
const classType = declaration.kind === 173 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : void 0;
|
|
55974
55983
|
const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
|
|
55975
55984
|
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
|
|
@@ -56083,7 +56092,11 @@ ${lanes.join("\n")}
|
|
|
56083
56092
|
if (node.tags) {
|
|
56084
56093
|
for (const tag of node.tags) {
|
|
56085
56094
|
if (isJSDocOverloadTag(tag)) {
|
|
56086
|
-
|
|
56095
|
+
const jsDocSignature = tag.typeExpression;
|
|
56096
|
+
if (jsDocSignature.type === void 0) {
|
|
56097
|
+
reportImplicitAny(jsDocSignature, anyType);
|
|
56098
|
+
}
|
|
56099
|
+
result.push(getSignatureFromDeclaration(jsDocSignature));
|
|
56087
56100
|
hasJSDocOverloads = true;
|
|
56088
56101
|
}
|
|
56089
56102
|
}
|
|
@@ -57782,7 +57795,7 @@ ${lanes.join("\n")}
|
|
|
57782
57795
|
function typePredicateKindsMatch(a, b) {
|
|
57783
57796
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
57784
57797
|
}
|
|
57785
|
-
function getUnionTypeFromSortedList(types,
|
|
57798
|
+
function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
|
|
57786
57799
|
if (types.length === 0) {
|
|
57787
57800
|
return neverType;
|
|
57788
57801
|
}
|
|
@@ -57794,7 +57807,7 @@ ${lanes.join("\n")}
|
|
|
57794
57807
|
let type = unionTypes.get(id);
|
|
57795
57808
|
if (!type) {
|
|
57796
57809
|
type = createType(1048576 /* Union */);
|
|
57797
|
-
type.objectFlags =
|
|
57810
|
+
type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
|
|
57798
57811
|
types,
|
|
57799
57812
|
/*excludeKinds*/
|
|
57800
57813
|
98304 /* Nullable */
|
|
@@ -58971,11 +58984,6 @@ ${lanes.join("\n")}
|
|
|
58971
58984
|
var _a2;
|
|
58972
58985
|
const links = getNodeLinks(node);
|
|
58973
58986
|
if (!links.resolvedType) {
|
|
58974
|
-
if (node.isTypeOf && node.typeArguments) {
|
|
58975
|
-
error(node, Diagnostics.Type_arguments_cannot_be_used_here);
|
|
58976
|
-
links.resolvedSymbol = unknownSymbol;
|
|
58977
|
-
return links.resolvedType = errorType;
|
|
58978
|
-
}
|
|
58979
58987
|
if (!isLiteralImportTypeNode(node)) {
|
|
58980
58988
|
error(node.argument, Diagnostics.String_literal_expected);
|
|
58981
58989
|
links.resolvedSymbol = unknownSymbol;
|
|
@@ -59036,7 +59044,7 @@ ${lanes.join("\n")}
|
|
|
59036
59044
|
const resolvedSymbol = resolveSymbol(symbol);
|
|
59037
59045
|
links.resolvedSymbol = resolvedSymbol;
|
|
59038
59046
|
if (meaning === 111551 /* Value */) {
|
|
59039
|
-
return getTypeOfSymbol(symbol);
|
|
59047
|
+
return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
|
|
59040
59048
|
} else {
|
|
59041
59049
|
const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
|
|
59042
59050
|
const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
|
|
@@ -61114,7 +61122,8 @@ ${lanes.join("\n")}
|
|
|
61114
61122
|
Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
|
|
61115
61123
|
generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
|
|
61116
61124
|
}
|
|
61117
|
-
|
|
61125
|
+
const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
|
|
61126
|
+
if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
|
|
61118
61127
|
const constraint = getBaseConstraintOfType(target2);
|
|
61119
61128
|
let needsOriginalSource;
|
|
61120
61129
|
if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
|
|
@@ -64032,6 +64041,11 @@ ${lanes.join("\n")}
|
|
|
64032
64041
|
case 320 /* JSDocFunctionType */:
|
|
64033
64042
|
error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
|
64034
64043
|
return;
|
|
64044
|
+
case 326 /* JSDocSignature */:
|
|
64045
|
+
if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
|
|
64046
|
+
error(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
|
|
64047
|
+
}
|
|
64048
|
+
return;
|
|
64035
64049
|
case 259 /* FunctionDeclaration */:
|
|
64036
64050
|
case 171 /* MethodDeclaration */:
|
|
64037
64051
|
case 170 /* MethodSignature */:
|
|
@@ -65777,7 +65791,7 @@ ${lanes.join("\n")}
|
|
|
65777
65791
|
}
|
|
65778
65792
|
return getUnionTypeFromSortedList(
|
|
65779
65793
|
filtered,
|
|
65780
|
-
type.objectFlags,
|
|
65794
|
+
type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
|
|
65781
65795
|
/*aliasSymbol*/
|
|
65782
65796
|
void 0,
|
|
65783
65797
|
/*aliasTypeArguments*/
|
|
@@ -67119,7 +67133,7 @@ ${lanes.join("\n")}
|
|
|
67119
67133
|
}
|
|
67120
67134
|
}
|
|
67121
67135
|
function getTypeOfSymbolAtLocation(symbol, location) {
|
|
67122
|
-
symbol = symbol
|
|
67136
|
+
symbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
67123
67137
|
if (location.kind === 79 /* Identifier */ || location.kind === 80 /* PrivateIdentifier */) {
|
|
67124
67138
|
if (isRightSideOfQualifiedNameOrPropertyAccess(location)) {
|
|
67125
67139
|
location = location.parent;
|
|
@@ -72759,6 +72773,9 @@ ${lanes.join("\n")}
|
|
|
72759
72773
|
checkGrammarExpressionWithTypeArguments(node);
|
|
72760
72774
|
forEach(node.typeArguments, checkSourceElement);
|
|
72761
72775
|
const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
72776
|
+
return getInstantiationExpressionType(exprType, node);
|
|
72777
|
+
}
|
|
72778
|
+
function getInstantiationExpressionType(exprType, node) {
|
|
72762
72779
|
const typeArguments = node.typeArguments;
|
|
72763
72780
|
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
|
|
72764
72781
|
return exprType;
|
|
@@ -75397,7 +75414,7 @@ ${lanes.join("\n")}
|
|
|
75397
75414
|
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
|
|
75398
75415
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
75399
75416
|
return getTypeFromTypeNode(expr.type);
|
|
75400
|
-
} else if (node
|
|
75417
|
+
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
|
|
75401
75418
|
return checkExpression(node);
|
|
75402
75419
|
}
|
|
75403
75420
|
return void 0;
|
|
@@ -81310,7 +81327,7 @@ ${lanes.join("\n")}
|
|
|
81310
81327
|
}
|
|
81311
81328
|
return node.parent.kind === 180 /* TypeReference */;
|
|
81312
81329
|
}
|
|
81313
|
-
function
|
|
81330
|
+
function isInNameOfExpressionWithTypeArguments(node) {
|
|
81314
81331
|
while (node.parent.kind === 208 /* PropertyAccessExpression */) {
|
|
81315
81332
|
node = node.parent;
|
|
81316
81333
|
}
|
|
@@ -81420,10 +81437,10 @@ ${lanes.join("\n")}
|
|
|
81420
81437
|
while (isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(name)) {
|
|
81421
81438
|
name = name.parent;
|
|
81422
81439
|
}
|
|
81423
|
-
if (
|
|
81440
|
+
if (isInNameOfExpressionWithTypeArguments(name)) {
|
|
81424
81441
|
let meaning = 0 /* None */;
|
|
81425
81442
|
if (name.parent.kind === 230 /* ExpressionWithTypeArguments */) {
|
|
81426
|
-
meaning = 788968 /* Type */;
|
|
81443
|
+
meaning = isPartOfTypeNode(name) ? 788968 /* Type */ : 111551 /* Value */;
|
|
81427
81444
|
if (isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) {
|
|
81428
81445
|
meaning |= 111551 /* Value */;
|
|
81429
81446
|
}
|
|
@@ -106718,7 +106735,7 @@ ${lanes.join("\n")}
|
|
|
106718
106735
|
if (elem.kind === 229 /* OmittedExpression */) {
|
|
106719
106736
|
return elem;
|
|
106720
106737
|
}
|
|
106721
|
-
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
|
|
106738
|
+
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
|
|
106722
106739
|
return factory2.updateBindingElement(
|
|
106723
106740
|
elem,
|
|
106724
106741
|
elem.dotDotDotToken,
|
|
@@ -126502,7 +126519,7 @@ ${lanes.join("\n")}
|
|
|
126502
126519
|
};
|
|
126503
126520
|
}
|
|
126504
126521
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
126505
|
-
return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */;
|
|
126522
|
+
return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
126506
126523
|
}
|
|
126507
126524
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
126508
126525
|
return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : void 0;
|
|
@@ -150294,12 +150311,12 @@ ${lanes.join("\n")}
|
|
|
150294
150311
|
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
|
|
150295
150312
|
const scriptPath = sourceFile.path;
|
|
150296
150313
|
const scriptDirectory = getDirectoryPath(scriptPath);
|
|
150297
|
-
const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
|
|
150314
|
+
const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, typeChecker, preferences, mode);
|
|
150298
150315
|
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
|
|
150299
150316
|
}
|
|
150300
|
-
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
|
|
150317
|
+
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
|
|
150301
150318
|
return {
|
|
150302
|
-
extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
|
|
150319
|
+
extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
|
|
150303
150320
|
referenceKind,
|
|
150304
150321
|
importingSourceFile,
|
|
150305
150322
|
endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
|
|
@@ -150329,8 +150346,17 @@ ${lanes.join("\n")}
|
|
|
150329
150346
|
).values());
|
|
150330
150347
|
}
|
|
150331
150348
|
}
|
|
150332
|
-
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
150333
|
-
const
|
|
150349
|
+
function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
|
|
150350
|
+
const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
|
|
150351
|
+
typeChecker.getAmbientModules(),
|
|
150352
|
+
(module2) => {
|
|
150353
|
+
const name = module2.name.slice(1, -1);
|
|
150354
|
+
if (!name.startsWith("*.") || name.includes("/"))
|
|
150355
|
+
return;
|
|
150356
|
+
return name.slice(1);
|
|
150357
|
+
}
|
|
150358
|
+
);
|
|
150359
|
+
const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
|
|
150334
150360
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
150335
150361
|
return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
|
|
150336
150362
|
}
|
package/lib/typescript.d.ts
CHANGED
|
@@ -2335,6 +2335,7 @@ declare namespace ts {
|
|
|
2335
2335
|
}
|
|
2336
2336
|
interface TypeChecker {
|
|
2337
2337
|
getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
|
|
2338
|
+
getTypeOfSymbol(symbol: Symbol): Type;
|
|
2338
2339
|
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
|
|
2339
2340
|
getPropertiesOfType(type: Type): Symbol[];
|
|
2340
2341
|
getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
|
|
@@ -2425,6 +2426,21 @@ declare namespace ts {
|
|
|
2425
2426
|
getApparentType(type: Type): Type;
|
|
2426
2427
|
getBaseConstraintOfType(type: Type): Type | undefined;
|
|
2427
2428
|
getDefaultFromTypeParameter(type: Type): Type | undefined;
|
|
2429
|
+
/**
|
|
2430
|
+
* True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts.
|
|
2431
|
+
* This function will _not_ return true if passed a type which
|
|
2432
|
+
* extends `Array` (for example, the TypeScript AST's `NodeArray` type).
|
|
2433
|
+
*/
|
|
2434
|
+
isArrayType(type: Type): boolean;
|
|
2435
|
+
/**
|
|
2436
|
+
* True if this type is a tuple type. This function will _not_ return true if
|
|
2437
|
+
* passed a type which extends from a tuple.
|
|
2438
|
+
*/
|
|
2439
|
+
isTupleType(type: Type): boolean;
|
|
2440
|
+
/**
|
|
2441
|
+
* True if this type is assignable to `ReadonlyArray<any>`.
|
|
2442
|
+
*/
|
|
2443
|
+
isArrayLikeType(type: Type): boolean;
|
|
2428
2444
|
getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
|
|
2429
2445
|
/**
|
|
2430
2446
|
* Depending on the operation performed, it may be appropriate to throw away the checker
|