typescript 5.1.0-dev.20230321 → 5.1.0-dev.20230323
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.es2015.core.d.ts +2 -2
- package/lib/lib.es2020.bigint.d.ts +4 -4
- package/lib/lib.es5.d.ts +18 -18
- package/lib/tsc.js +132 -81
- package/lib/tsserver.js +144 -92
- package/lib/tsserverlibrary.js +142 -90
- package/lib/typescript.js +140 -88
- package/lib/typingsInstaller.js +4 -2
- package/package.json +2 -2
package/lib/lib.es2015.core.d.ts
CHANGED
|
@@ -56,10 +56,10 @@ interface Array<T> {
|
|
|
56
56
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
57
57
|
* length of the array.
|
|
58
58
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
59
|
-
* is treated as length+end.
|
|
59
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
60
60
|
* @param end If not specified, length of the this object is used as its default value.
|
|
61
61
|
*/
|
|
62
|
-
copyWithin(target: number, start
|
|
62
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
interface ArrayConstructor {
|
|
@@ -165,10 +165,10 @@ interface BigInt64Array {
|
|
|
165
165
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
166
166
|
* length of the array.
|
|
167
167
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
168
|
-
* is treated as length+end.
|
|
168
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
169
169
|
* @param end If not specified, length of the this object is used as its default value.
|
|
170
170
|
*/
|
|
171
|
-
copyWithin(target: number, start
|
|
171
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
172
172
|
|
|
173
173
|
/** Yields index, value pairs for every entry in the array. */
|
|
174
174
|
entries(): IterableIterator<[number, bigint]>;
|
|
@@ -437,10 +437,10 @@ interface BigUint64Array {
|
|
|
437
437
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
438
438
|
* length of the array.
|
|
439
439
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
440
|
-
* is treated as length+end.
|
|
440
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
441
441
|
* @param end If not specified, length of the this object is used as its default value.
|
|
442
442
|
*/
|
|
443
|
-
copyWithin(target: number, start
|
|
443
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
444
444
|
|
|
445
445
|
/** Yields index, value pairs for every entry in the array. */
|
|
446
446
|
entries(): IterableIterator<[number, bigint]>;
|
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1867,10 +1867,10 @@ interface Int8Array {
|
|
|
1867
1867
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
1868
1868
|
* length of the array.
|
|
1869
1869
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
1870
|
-
* is treated as length+end.
|
|
1870
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
1871
1871
|
* @param end If not specified, length of the this object is used as its default value.
|
|
1872
1872
|
*/
|
|
1873
|
-
copyWithin(target: number, start
|
|
1873
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
1874
1874
|
|
|
1875
1875
|
/**
|
|
1876
1876
|
* Determines whether all the members of an array satisfy the specified test.
|
|
@@ -2149,10 +2149,10 @@ interface Uint8Array {
|
|
|
2149
2149
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
2150
2150
|
* length of the array.
|
|
2151
2151
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
2152
|
-
* is treated as length+end.
|
|
2152
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
2153
2153
|
* @param end If not specified, length of the this object is used as its default value.
|
|
2154
2154
|
*/
|
|
2155
|
-
copyWithin(target: number, start
|
|
2155
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
2156
2156
|
|
|
2157
2157
|
/**
|
|
2158
2158
|
* Determines whether all the members of an array satisfy the specified test.
|
|
@@ -2431,10 +2431,10 @@ interface Uint8ClampedArray {
|
|
|
2431
2431
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
2432
2432
|
* length of the array.
|
|
2433
2433
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
2434
|
-
* is treated as length+end.
|
|
2434
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
2435
2435
|
* @param end If not specified, length of the this object is used as its default value.
|
|
2436
2436
|
*/
|
|
2437
|
-
copyWithin(target: number, start
|
|
2437
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
2438
2438
|
|
|
2439
2439
|
/**
|
|
2440
2440
|
* Determines whether all the members of an array satisfy the specified test.
|
|
@@ -2712,10 +2712,10 @@ interface Int16Array {
|
|
|
2712
2712
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
2713
2713
|
* length of the array.
|
|
2714
2714
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
2715
|
-
* is treated as length+end.
|
|
2715
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
2716
2716
|
* @param end If not specified, length of the this object is used as its default value.
|
|
2717
2717
|
*/
|
|
2718
|
-
copyWithin(target: number, start
|
|
2718
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
2719
2719
|
|
|
2720
2720
|
/**
|
|
2721
2721
|
* Determines whether all the members of an array satisfy the specified test.
|
|
@@ -2994,10 +2994,10 @@ interface Uint16Array {
|
|
|
2994
2994
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
2995
2995
|
* length of the array.
|
|
2996
2996
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
2997
|
-
* is treated as length+end.
|
|
2997
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
2998
2998
|
* @param end If not specified, length of the this object is used as its default value.
|
|
2999
2999
|
*/
|
|
3000
|
-
copyWithin(target: number, start
|
|
3000
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
3001
3001
|
|
|
3002
3002
|
/**
|
|
3003
3003
|
* Determines whether all the members of an array satisfy the specified test.
|
|
@@ -3276,10 +3276,10 @@ interface Int32Array {
|
|
|
3276
3276
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
3277
3277
|
* length of the array.
|
|
3278
3278
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
3279
|
-
* is treated as length+end.
|
|
3279
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
3280
3280
|
* @param end If not specified, length of the this object is used as its default value.
|
|
3281
3281
|
*/
|
|
3282
|
-
copyWithin(target: number, start
|
|
3282
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
3283
3283
|
|
|
3284
3284
|
/**
|
|
3285
3285
|
* Determines whether all the members of an array satisfy the specified test.
|
|
@@ -3558,10 +3558,10 @@ interface Uint32Array {
|
|
|
3558
3558
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
3559
3559
|
* length of the array.
|
|
3560
3560
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
3561
|
-
* is treated as length+end.
|
|
3561
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
3562
3562
|
* @param end If not specified, length of the this object is used as its default value.
|
|
3563
3563
|
*/
|
|
3564
|
-
copyWithin(target: number, start
|
|
3564
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
3565
3565
|
|
|
3566
3566
|
/**
|
|
3567
3567
|
* Determines whether all the members of an array satisfy the specified test.
|
|
@@ -3839,10 +3839,10 @@ interface Float32Array {
|
|
|
3839
3839
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
3840
3840
|
* length of the array.
|
|
3841
3841
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
3842
|
-
* is treated as length+end.
|
|
3842
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
3843
3843
|
* @param end If not specified, length of the this object is used as its default value.
|
|
3844
3844
|
*/
|
|
3845
|
-
copyWithin(target: number, start
|
|
3845
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
3846
3846
|
|
|
3847
3847
|
/**
|
|
3848
3848
|
* Determines whether all the members of an array satisfy the specified test.
|
|
@@ -4122,10 +4122,10 @@ interface Float64Array {
|
|
|
4122
4122
|
* @param target If target is negative, it is treated as length+target where length is the
|
|
4123
4123
|
* length of the array.
|
|
4124
4124
|
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
4125
|
-
* is treated as length+end.
|
|
4125
|
+
* is treated as length+end. If start is omitted, `0` is used.
|
|
4126
4126
|
* @param end If not specified, length of the this object is used as its default value.
|
|
4127
4127
|
*/
|
|
4128
|
-
copyWithin(target: number, start
|
|
4128
|
+
copyWithin(target: number, start?: number, end?: number): this;
|
|
4129
4129
|
|
|
4130
4130
|
/**
|
|
4131
4131
|
* Determines whether all the members of an array satisfy the specified test.
|
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.1";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230323`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6634,6 +6634,7 @@ var Diagnostics = {
|
|
|
6634
6634
|
A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"),
|
|
6635
6635
|
A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value: diag(2847, 1 /* Error */, "A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2847", "A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."),
|
|
6636
6636
|
The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."),
|
|
6637
|
+
Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1: diag(2849, 1 /* Error */, "Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1_2849", "Target signature provides too few arguments. Expected {0} or more, but got {1}."),
|
|
6637
6638
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6638
6639
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6639
6640
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -12550,9 +12551,8 @@ function isPartOfTypeNode(node) {
|
|
|
12550
12551
|
return node === parent.type;
|
|
12551
12552
|
case 211 /* CallExpression */:
|
|
12552
12553
|
case 212 /* NewExpression */:
|
|
12553
|
-
return contains(parent.typeArguments, node);
|
|
12554
12554
|
case 213 /* TaggedTemplateExpression */:
|
|
12555
|
-
return
|
|
12555
|
+
return contains(parent.typeArguments, node);
|
|
12556
12556
|
}
|
|
12557
12557
|
}
|
|
12558
12558
|
}
|
|
@@ -12711,17 +12711,20 @@ function isObjectLiteralOrClassExpressionMethodOrAccessor(node) {
|
|
|
12711
12711
|
function isIdentifierTypePredicate(predicate) {
|
|
12712
12712
|
return predicate && predicate.kind === 1 /* Identifier */;
|
|
12713
12713
|
}
|
|
12714
|
-
function
|
|
12715
|
-
return objectLiteral.properties
|
|
12716
|
-
if (property
|
|
12717
|
-
|
|
12718
|
-
|
|
12719
|
-
|
|
12720
|
-
return false;
|
|
12714
|
+
function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
12715
|
+
return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
|
|
12716
|
+
if (!isPropertyAssignment(property))
|
|
12717
|
+
return void 0;
|
|
12718
|
+
const propName = tryGetTextOfPropertyName(property.name);
|
|
12719
|
+
return key === propName || key2 && key2 === propName ? callback(property) : void 0;
|
|
12721
12720
|
});
|
|
12722
12721
|
}
|
|
12723
12722
|
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
|
12724
|
-
return
|
|
12723
|
+
return forEachPropertyAssignment(
|
|
12724
|
+
objectLiteral,
|
|
12725
|
+
propKey,
|
|
12726
|
+
(property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
|
|
12727
|
+
);
|
|
12725
12728
|
}
|
|
12726
12729
|
function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
|
12727
12730
|
if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
|
|
@@ -12730,11 +12733,10 @@ function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
|
|
12730
12733
|
}
|
|
12731
12734
|
}
|
|
12732
12735
|
function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) {
|
|
12733
|
-
return
|
|
12736
|
+
return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
|
12734
12737
|
}
|
|
12735
|
-
function
|
|
12736
|
-
|
|
12737
|
-
return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : emptyArray;
|
|
12738
|
+
function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
|
|
12739
|
+
return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback);
|
|
12738
12740
|
}
|
|
12739
12741
|
function getContainingFunction(node) {
|
|
12740
12742
|
return findAncestor(node.parent, isFunctionLike);
|
|
@@ -34065,6 +34067,7 @@ var commandOptionsWithoutBuild = [
|
|
|
34065
34067
|
name: "allowImportingTsExtensions",
|
|
34066
34068
|
type: "boolean",
|
|
34067
34069
|
affectsSemanticDiagnostics: true,
|
|
34070
|
+
affectsBuildInfo: true,
|
|
34068
34071
|
category: Diagnostics.Modules,
|
|
34069
34072
|
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
|
|
34070
34073
|
defaultValueDescription: false
|
|
@@ -35496,7 +35499,7 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
35496
35499
|
if (sourceFile) {
|
|
35497
35500
|
const fileName = configFileName || "tsconfig.json";
|
|
35498
35501
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
35499
|
-
const nodeValue =
|
|
35502
|
+
const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
|
|
35500
35503
|
const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
35501
35504
|
errors.push(error);
|
|
35502
35505
|
} else {
|
|
@@ -37314,7 +37317,7 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos
|
|
|
37314
37317
|
}
|
|
37315
37318
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
37316
37319
|
return nodeModuleNameResolverWorker(
|
|
37317
|
-
|
|
37320
|
+
30 /* NodeNextDefault */,
|
|
37318
37321
|
moduleName,
|
|
37319
37322
|
getDirectoryPath(containingFile),
|
|
37320
37323
|
{ moduleResolution: 99 /* NodeNext */ },
|
|
@@ -45479,7 +45482,7 @@ function createTypeChecker(host) {
|
|
|
45479
45482
|
return void 0;
|
|
45480
45483
|
}
|
|
45481
45484
|
} else {
|
|
45482
|
-
|
|
45485
|
+
Debug.assertNever(name, "Unknown entity name kind.");
|
|
45483
45486
|
}
|
|
45484
45487
|
Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
|
|
45485
45488
|
if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 275 /* ExportAssignment */)) {
|
|
@@ -53364,7 +53367,7 @@ function createTypeChecker(host) {
|
|
|
53364
53367
|
return simplified !== type ? simplified : getConstraintOfType(type);
|
|
53365
53368
|
}
|
|
53366
53369
|
function getConstraintFromIndexedAccess(type) {
|
|
53367
|
-
if (isMappedTypeGenericIndexedAccess(type)) {
|
|
53370
|
+
if (isMappedTypeGenericIndexedAccess(type) || isGenericMappedType(type.objectType)) {
|
|
53368
53371
|
return substituteIndexedMappedType(type.objectType, type.indexType);
|
|
53369
53372
|
}
|
|
53370
53373
|
const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
|
|
@@ -55752,6 +55755,12 @@ function createTypeChecker(host) {
|
|
|
55752
55755
|
i--;
|
|
55753
55756
|
const source = types[i];
|
|
55754
55757
|
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
55758
|
+
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
55759
|
+
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
55760
|
+
orderedRemoveItemAt(types, i);
|
|
55761
|
+
}
|
|
55762
|
+
continue;
|
|
55763
|
+
}
|
|
55755
55764
|
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
55756
55765
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
55757
55766
|
for (const target of types) {
|
|
@@ -56319,7 +56328,7 @@ function createTypeChecker(host) {
|
|
|
56319
56328
|
links.resolvedType = getTypeFromTypeNode(node.type);
|
|
56320
56329
|
break;
|
|
56321
56330
|
default:
|
|
56322
|
-
|
|
56331
|
+
Debug.assertNever(node.operator);
|
|
56323
56332
|
}
|
|
56324
56333
|
}
|
|
56325
56334
|
return links.resolvedType;
|
|
@@ -57286,7 +57295,10 @@ function createTypeChecker(host) {
|
|
|
57286
57295
|
const declarations = concatenate(leftProp.declarations, rightProp.declarations);
|
|
57287
57296
|
const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */;
|
|
57288
57297
|
const result = createSymbol(flags, leftProp.escapedName);
|
|
57289
|
-
|
|
57298
|
+
const leftType = getTypeOfSymbol(leftProp);
|
|
57299
|
+
const leftTypeWithoutUndefined = removeMissingOrUndefinedType(leftType);
|
|
57300
|
+
const rightTypeWithoutUndefined = removeMissingOrUndefinedType(rightType);
|
|
57301
|
+
result.links.type = leftTypeWithoutUndefined === rightTypeWithoutUndefined ? leftType : getUnionType([leftType, rightTypeWithoutUndefined], 2 /* Subtype */);
|
|
57290
57302
|
result.links.leftSpread = leftProp;
|
|
57291
57303
|
result.links.rightSpread = rightProp;
|
|
57292
57304
|
result.declarations = declarations;
|
|
@@ -58709,6 +58721,9 @@ function createTypeChecker(host) {
|
|
|
58709
58721
|
const targetCount = getParameterCount(target);
|
|
58710
58722
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
58711
58723
|
if (sourceHasMoreParameters) {
|
|
58724
|
+
if (reportErrors2 && !(checkMode & 8 /* StrictArity */)) {
|
|
58725
|
+
errorReporter(Diagnostics.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1, getMinArgumentCount(source), targetCount);
|
|
58726
|
+
}
|
|
58712
58727
|
return 0 /* False */;
|
|
58713
58728
|
}
|
|
58714
58729
|
if (source.typeParameters && source.typeParameters !== target.typeParameters) {
|
|
@@ -60417,6 +60432,26 @@ function createTypeChecker(host) {
|
|
|
60417
60432
|
)) {
|
|
60418
60433
|
return result2;
|
|
60419
60434
|
}
|
|
60435
|
+
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
60436
|
+
const indexType = source2.indexType;
|
|
60437
|
+
if (indexType.flags & 4194304 /* Index */) {
|
|
60438
|
+
const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
|
|
60439
|
+
const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
|
|
60440
|
+
const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
|
|
60441
|
+
if (result2 = isRelatedTo(
|
|
60442
|
+
constraint2,
|
|
60443
|
+
target2,
|
|
60444
|
+
1 /* Source */,
|
|
60445
|
+
/*reportErrors*/
|
|
60446
|
+
false,
|
|
60447
|
+
/*headMessage*/
|
|
60448
|
+
void 0,
|
|
60449
|
+
intersectionState
|
|
60450
|
+
)) {
|
|
60451
|
+
return result2;
|
|
60452
|
+
}
|
|
60453
|
+
}
|
|
60454
|
+
}
|
|
60420
60455
|
if (isMappedTypeGenericIndexedAccess(source2)) {
|
|
60421
60456
|
const indexConstraint = getConstraintOfType(source2.indexType);
|
|
60422
60457
|
if (indexConstraint) {
|
|
@@ -61608,7 +61643,7 @@ function createTypeChecker(host) {
|
|
|
61608
61643
|
return type.symbol;
|
|
61609
61644
|
}
|
|
61610
61645
|
if (isTupleType(type)) {
|
|
61611
|
-
return type;
|
|
61646
|
+
return type.target;
|
|
61612
61647
|
}
|
|
61613
61648
|
}
|
|
61614
61649
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
@@ -62851,21 +62886,19 @@ function createTypeChecker(host) {
|
|
|
62851
62886
|
const saveInferencePriority = inferencePriority;
|
|
62852
62887
|
inferencePriority = 2048 /* MaxValue */;
|
|
62853
62888
|
const saveExpandingFlags = expandingFlags;
|
|
62854
|
-
|
|
62855
|
-
|
|
62856
|
-
if (
|
|
62889
|
+
(sourceStack != null ? sourceStack : sourceStack = []).push(source);
|
|
62890
|
+
(targetStack != null ? targetStack : targetStack = []).push(target);
|
|
62891
|
+
if (isDeeplyNestedType(source, sourceStack, sourceStack.length, 2))
|
|
62857
62892
|
expandingFlags |= 1 /* Source */;
|
|
62858
|
-
if (
|
|
62893
|
+
if (isDeeplyNestedType(target, targetStack, targetStack.length, 2))
|
|
62859
62894
|
expandingFlags |= 2 /* Target */;
|
|
62860
62895
|
if (expandingFlags !== 3 /* Both */) {
|
|
62861
|
-
(sourceStack || (sourceStack = [])).push(sourceIdentity);
|
|
62862
|
-
(targetStack || (targetStack = [])).push(targetIdentity);
|
|
62863
62896
|
action(source, target);
|
|
62864
|
-
targetStack.pop();
|
|
62865
|
-
sourceStack.pop();
|
|
62866
62897
|
} else {
|
|
62867
62898
|
inferencePriority = -1 /* Circularity */;
|
|
62868
62899
|
}
|
|
62900
|
+
targetStack.pop();
|
|
62901
|
+
sourceStack.pop();
|
|
62869
62902
|
expandingFlags = saveExpandingFlags;
|
|
62870
62903
|
visited.set(key, inferencePriority);
|
|
62871
62904
|
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
|
|
@@ -70593,7 +70626,7 @@ function createTypeChecker(host) {
|
|
|
70593
70626
|
case 283 /* JsxSelfClosingElement */:
|
|
70594
70627
|
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
|
|
70595
70628
|
}
|
|
70596
|
-
|
|
70629
|
+
Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
|
|
70597
70630
|
}
|
|
70598
70631
|
function getResolvedSignature(node, candidatesOutArray, checkMode) {
|
|
70599
70632
|
const links = getNodeLinks(node);
|
|
@@ -81868,7 +81901,7 @@ function createTypeChecker(host) {
|
|
|
81868
81901
|
currentKind = 2 /* SetAccessor */;
|
|
81869
81902
|
break;
|
|
81870
81903
|
default:
|
|
81871
|
-
|
|
81904
|
+
Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
|
|
81872
81905
|
}
|
|
81873
81906
|
if (!inDestructuring) {
|
|
81874
81907
|
const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
|
|
@@ -94579,10 +94612,13 @@ function transformJsx(context) {
|
|
|
94579
94612
|
return Debug.failBadSyntaxKind(node);
|
|
94580
94613
|
}
|
|
94581
94614
|
}
|
|
94615
|
+
function hasProto(obj) {
|
|
94616
|
+
return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
|
|
94617
|
+
}
|
|
94582
94618
|
function hasKeyAfterPropsSpread(node) {
|
|
94583
94619
|
let spread = false;
|
|
94584
94620
|
for (const elem of node.attributes.properties) {
|
|
94585
|
-
if (isJsxSpreadAttribute(elem)) {
|
|
94621
|
+
if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
|
|
94586
94622
|
spread = true;
|
|
94587
94623
|
} else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
|
|
94588
94624
|
return true;
|
|
@@ -94748,7 +94784,10 @@ function transformJsx(context) {
|
|
|
94748
94784
|
}
|
|
94749
94785
|
return element;
|
|
94750
94786
|
}
|
|
94751
|
-
function
|
|
94787
|
+
function transformJsxSpreadAttributeToProps(node) {
|
|
94788
|
+
if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
|
|
94789
|
+
return node.expression.properties;
|
|
94790
|
+
}
|
|
94752
94791
|
return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
|
|
94753
94792
|
}
|
|
94754
94793
|
function transformJsxAttributesToObjectProps(attrs, children) {
|
|
@@ -94756,30 +94795,48 @@ function transformJsx(context) {
|
|
|
94756
94795
|
return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
|
|
94757
94796
|
}
|
|
94758
94797
|
function transformJsxAttributesToProps(attrs, children) {
|
|
94759
|
-
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ?
|
|
94798
|
+
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
|
|
94760
94799
|
if (children) {
|
|
94761
94800
|
props.push(children);
|
|
94762
94801
|
}
|
|
94763
94802
|
return props;
|
|
94764
94803
|
}
|
|
94765
94804
|
function transformJsxAttributesToExpression(attrs, children) {
|
|
94766
|
-
const expressions =
|
|
94767
|
-
|
|
94768
|
-
|
|
94769
|
-
|
|
94770
|
-
(
|
|
94771
|
-
|
|
94772
|
-
|
|
94773
|
-
|
|
94774
|
-
|
|
94805
|
+
const expressions = [];
|
|
94806
|
+
let properties = [];
|
|
94807
|
+
for (const attr of attrs) {
|
|
94808
|
+
if (isJsxSpreadAttribute(attr)) {
|
|
94809
|
+
if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
|
|
94810
|
+
for (const prop of attr.expression.properties) {
|
|
94811
|
+
if (isSpreadAssignment(prop)) {
|
|
94812
|
+
finishObjectLiteralIfNeeded();
|
|
94813
|
+
expressions.push(prop.expression);
|
|
94814
|
+
continue;
|
|
94815
|
+
}
|
|
94816
|
+
properties.push(prop);
|
|
94817
|
+
}
|
|
94818
|
+
continue;
|
|
94819
|
+
}
|
|
94820
|
+
finishObjectLiteralIfNeeded();
|
|
94821
|
+
expressions.push(attr.expression);
|
|
94822
|
+
continue;
|
|
94823
|
+
}
|
|
94824
|
+
properties.push(transformJsxAttributeToObjectLiteralElement(attr));
|
|
94775
94825
|
}
|
|
94776
94826
|
if (children) {
|
|
94777
|
-
|
|
94827
|
+
properties.push(children);
|
|
94828
|
+
}
|
|
94829
|
+
finishObjectLiteralIfNeeded();
|
|
94830
|
+
if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
|
|
94831
|
+
expressions.unshift(factory2.createObjectLiteralExpression());
|
|
94778
94832
|
}
|
|
94779
94833
|
return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
|
|
94780
|
-
|
|
94781
|
-
|
|
94782
|
-
|
|
94834
|
+
function finishObjectLiteralIfNeeded() {
|
|
94835
|
+
if (properties.length) {
|
|
94836
|
+
expressions.push(factory2.createObjectLiteralExpression(properties));
|
|
94837
|
+
properties = [];
|
|
94838
|
+
}
|
|
94839
|
+
}
|
|
94783
94840
|
}
|
|
94784
94841
|
function transformJsxAttributeToObjectLiteralElement(node) {
|
|
94785
94842
|
const name = getAttributeName(node);
|
|
@@ -115617,8 +115674,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115617
115674
|
if (!referenceInfo)
|
|
115618
115675
|
return void 0;
|
|
115619
115676
|
const { sourceFile, index } = referenceInfo;
|
|
115620
|
-
const referencesSyntax =
|
|
115621
|
-
|
|
115677
|
+
const referencesSyntax = forEachTsConfigPropArray(
|
|
115678
|
+
sourceFile,
|
|
115679
|
+
"references",
|
|
115622
115680
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
115623
115681
|
);
|
|
115624
115682
|
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
|
@@ -115689,26 +115747,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115689
115747
|
}
|
|
115690
115748
|
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
|
|
115691
115749
|
let needCompilerDiagnostic = true;
|
|
115692
|
-
|
|
115693
|
-
for (const pathProp of pathsSyntax) {
|
|
115750
|
+
forEachOptionPathsSyntax((pathProp) => {
|
|
115694
115751
|
if (isObjectLiteralExpression(pathProp.initializer)) {
|
|
115695
|
-
|
|
115752
|
+
forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
|
|
115696
115753
|
const initializer = keyProps.initializer;
|
|
115697
115754
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
|
115698
115755
|
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
|
115699
115756
|
needCompilerDiagnostic = false;
|
|
115700
115757
|
}
|
|
115701
|
-
}
|
|
115758
|
+
});
|
|
115702
115759
|
}
|
|
115703
|
-
}
|
|
115760
|
+
});
|
|
115704
115761
|
if (needCompilerDiagnostic) {
|
|
115705
115762
|
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115706
115763
|
}
|
|
115707
115764
|
}
|
|
115708
115765
|
function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
|
|
115709
115766
|
let needCompilerDiagnostic = true;
|
|
115710
|
-
|
|
115711
|
-
for (const pathProp of pathsSyntax) {
|
|
115767
|
+
forEachOptionPathsSyntax((pathProp) => {
|
|
115712
115768
|
if (isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax(
|
|
115713
115769
|
pathProp.initializer,
|
|
115714
115770
|
onKey,
|
|
@@ -115720,21 +115776,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115720
115776
|
)) {
|
|
115721
115777
|
needCompilerDiagnostic = false;
|
|
115722
115778
|
}
|
|
115723
|
-
}
|
|
115779
|
+
});
|
|
115724
115780
|
if (needCompilerDiagnostic) {
|
|
115725
115781
|
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115726
115782
|
}
|
|
115727
115783
|
}
|
|
115728
|
-
function
|
|
115729
|
-
|
|
115730
|
-
return compilerOptionsObjectLiteralSyntax && getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name);
|
|
115784
|
+
function forEachOptionsSyntaxByName(name, callback) {
|
|
115785
|
+
return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
|
|
115731
115786
|
}
|
|
115732
|
-
function
|
|
115733
|
-
return
|
|
115787
|
+
function forEachOptionPathsSyntax(callback) {
|
|
115788
|
+
return forEachOptionsSyntaxByName("paths", callback);
|
|
115734
115789
|
}
|
|
115735
115790
|
function getOptionsSyntaxByValue(name, value) {
|
|
115736
|
-
|
|
115737
|
-
return syntaxByName && firstDefined(syntaxByName, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
|
115791
|
+
return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
|
115738
115792
|
}
|
|
115739
115793
|
function getOptionsSyntaxByArrayElementValue(name, value) {
|
|
115740
115794
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
@@ -115764,8 +115818,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115764
115818
|
);
|
|
115765
115819
|
}
|
|
115766
115820
|
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
115767
|
-
const referencesSyntax =
|
|
115768
|
-
|
|
115821
|
+
const referencesSyntax = forEachTsConfigPropArray(
|
|
115822
|
+
sourceFile || options.configFile,
|
|
115823
|
+
"references",
|
|
115769
115824
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
115770
115825
|
);
|
|
115771
115826
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
@@ -115787,29 +115842,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115787
115842
|
}
|
|
115788
115843
|
function getCompilerOptionsObjectLiteralSyntax() {
|
|
115789
115844
|
if (_compilerOptionsObjectLiteralSyntax === void 0) {
|
|
115790
|
-
_compilerOptionsObjectLiteralSyntax =
|
|
115791
|
-
|
|
115792
|
-
|
|
115793
|
-
|
|
115794
|
-
|
|
115795
|
-
_compilerOptionsObjectLiteralSyntax = prop.initializer;
|
|
115796
|
-
break;
|
|
115797
|
-
}
|
|
115798
|
-
}
|
|
115799
|
-
}
|
|
115845
|
+
_compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
|
|
115846
|
+
getTsConfigObjectLiteralExpression(options.configFile),
|
|
115847
|
+
"compilerOptions",
|
|
115848
|
+
(prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
|
|
115849
|
+
) || false;
|
|
115800
115850
|
}
|
|
115801
115851
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
115802
115852
|
}
|
|
115803
115853
|
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
|
|
115804
|
-
|
|
115805
|
-
|
|
115854
|
+
let needsCompilerDiagnostic = false;
|
|
115855
|
+
forEachPropertyAssignment(objectLiteral, key1, (prop) => {
|
|
115806
115856
|
if ("messageText" in message) {
|
|
115807
115857
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
115808
115858
|
} else {
|
|
115809
115859
|
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
|
115810
115860
|
}
|
|
115811
|
-
|
|
115812
|
-
|
|
115861
|
+
needsCompilerDiagnostic = true;
|
|
115862
|
+
}, key2);
|
|
115863
|
+
return needsCompilerDiagnostic;
|
|
115813
115864
|
}
|
|
115814
115865
|
function createRedundantOptionDiagnostic(errorOnOption, redundantWithOption) {
|
|
115815
115866
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|