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/tsserver.js
CHANGED
|
@@ -604,10 +604,12 @@ __export(server_exports, {
|
|
|
604
604
|
forEachKey: () => forEachKey,
|
|
605
605
|
forEachLeadingCommentRange: () => forEachLeadingCommentRange,
|
|
606
606
|
forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
|
|
607
|
+
forEachPropertyAssignment: () => forEachPropertyAssignment,
|
|
607
608
|
forEachResolvedProjectReference: () => forEachResolvedProjectReference,
|
|
608
609
|
forEachReturnStatement: () => forEachReturnStatement,
|
|
609
610
|
forEachRight: () => forEachRight,
|
|
610
611
|
forEachTrailingCommentRange: () => forEachTrailingCommentRange,
|
|
612
|
+
forEachTsConfigPropArray: () => forEachTsConfigPropArray,
|
|
611
613
|
forEachUnique: () => forEachUnique,
|
|
612
614
|
forEachYieldExpression: () => forEachYieldExpression,
|
|
613
615
|
forSomeAncestorDirectory: () => forSomeAncestorDirectory,
|
|
@@ -940,7 +942,6 @@ __export(server_exports, {
|
|
|
940
942
|
getProperties: () => getProperties,
|
|
941
943
|
getProperty: () => getProperty,
|
|
942
944
|
getPropertyArrayElementValue: () => getPropertyArrayElementValue,
|
|
943
|
-
getPropertyAssignment: () => getPropertyAssignment,
|
|
944
945
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
|
945
946
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
|
946
947
|
getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
|
|
@@ -1045,7 +1046,6 @@ __export(server_exports, {
|
|
|
1045
1046
|
getTransformers: () => getTransformers,
|
|
1046
1047
|
getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
|
|
1047
1048
|
getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
|
|
1048
|
-
getTsConfigPropArray: () => getTsConfigPropArray,
|
|
1049
1049
|
getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
|
|
1050
1050
|
getTypeAnnotationNode: () => getTypeAnnotationNode,
|
|
1051
1051
|
getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,
|
|
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2286
2286
|
|
|
2287
2287
|
// src/compiler/corePublic.ts
|
|
2288
2288
|
var versionMajorMinor = "5.1";
|
|
2289
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2289
|
+
var version = `${versionMajorMinor}.0-dev.20230323`;
|
|
2290
2290
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2291
2291
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2292
2292
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10121,6 +10121,7 @@ var Diagnostics = {
|
|
|
10121
10121
|
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?"),
|
|
10122
10122
|
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."),
|
|
10123
10123
|
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."),
|
|
10124
|
+
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}."),
|
|
10124
10125
|
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}'."),
|
|
10125
10126
|
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}'."),
|
|
10126
10127
|
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}'."),
|
|
@@ -16336,9 +16337,8 @@ function isPartOfTypeNode(node) {
|
|
|
16336
16337
|
return node === parent2.type;
|
|
16337
16338
|
case 211 /* CallExpression */:
|
|
16338
16339
|
case 212 /* NewExpression */:
|
|
16339
|
-
return contains(parent2.typeArguments, node);
|
|
16340
16340
|
case 213 /* TaggedTemplateExpression */:
|
|
16341
|
-
return
|
|
16341
|
+
return contains(parent2.typeArguments, node);
|
|
16342
16342
|
}
|
|
16343
16343
|
}
|
|
16344
16344
|
}
|
|
@@ -16500,17 +16500,20 @@ function isIdentifierTypePredicate(predicate) {
|
|
|
16500
16500
|
function isThisTypePredicate(predicate) {
|
|
16501
16501
|
return predicate && predicate.kind === 0 /* This */;
|
|
16502
16502
|
}
|
|
16503
|
-
function
|
|
16504
|
-
return objectLiteral.properties
|
|
16505
|
-
if (property
|
|
16506
|
-
|
|
16507
|
-
|
|
16508
|
-
|
|
16509
|
-
return false;
|
|
16503
|
+
function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
16504
|
+
return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
|
|
16505
|
+
if (!isPropertyAssignment(property))
|
|
16506
|
+
return void 0;
|
|
16507
|
+
const propName = tryGetTextOfPropertyName(property.name);
|
|
16508
|
+
return key === propName || key2 && key2 === propName ? callback(property) : void 0;
|
|
16510
16509
|
});
|
|
16511
16510
|
}
|
|
16512
16511
|
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
|
16513
|
-
return
|
|
16512
|
+
return forEachPropertyAssignment(
|
|
16513
|
+
objectLiteral,
|
|
16514
|
+
propKey,
|
|
16515
|
+
(property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
|
|
16516
|
+
);
|
|
16514
16517
|
}
|
|
16515
16518
|
function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
|
16516
16519
|
if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
|
|
@@ -16519,11 +16522,10 @@ function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
|
|
16519
16522
|
}
|
|
16520
16523
|
}
|
|
16521
16524
|
function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) {
|
|
16522
|
-
return
|
|
16525
|
+
return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
|
16523
16526
|
}
|
|
16524
|
-
function
|
|
16525
|
-
|
|
16526
|
-
return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : emptyArray;
|
|
16527
|
+
function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
|
|
16528
|
+
return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback);
|
|
16527
16529
|
}
|
|
16528
16530
|
function getContainingFunction(node) {
|
|
16529
16531
|
return findAncestor(node.parent, isFunctionLike);
|
|
@@ -38426,6 +38428,7 @@ var commandOptionsWithoutBuild = [
|
|
|
38426
38428
|
name: "allowImportingTsExtensions",
|
|
38427
38429
|
type: "boolean",
|
|
38428
38430
|
affectsSemanticDiagnostics: true,
|
|
38431
|
+
affectsBuildInfo: true,
|
|
38429
38432
|
category: Diagnostics.Modules,
|
|
38430
38433
|
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
|
|
38431
38434
|
defaultValueDescription: false
|
|
@@ -39882,7 +39885,7 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
39882
39885
|
if (sourceFile) {
|
|
39883
39886
|
const fileName = configFileName || "tsconfig.json";
|
|
39884
39887
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
39885
|
-
const nodeValue =
|
|
39888
|
+
const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
|
|
39886
39889
|
const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
39887
39890
|
errors.push(error);
|
|
39888
39891
|
} else {
|
|
@@ -41786,7 +41789,7 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos
|
|
|
41786
41789
|
}
|
|
41787
41790
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
41788
41791
|
return nodeModuleNameResolverWorker(
|
|
41789
|
-
|
|
41792
|
+
30 /* NodeNextDefault */,
|
|
41790
41793
|
moduleName,
|
|
41791
41794
|
getDirectoryPath(containingFile),
|
|
41792
41795
|
{ moduleResolution: 99 /* NodeNext */ },
|
|
@@ -50106,7 +50109,7 @@ function createTypeChecker(host) {
|
|
|
50106
50109
|
return void 0;
|
|
50107
50110
|
}
|
|
50108
50111
|
} else {
|
|
50109
|
-
|
|
50112
|
+
Debug.assertNever(name, "Unknown entity name kind.");
|
|
50110
50113
|
}
|
|
50111
50114
|
Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
|
|
50112
50115
|
if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 275 /* ExportAssignment */)) {
|
|
@@ -57991,7 +57994,7 @@ function createTypeChecker(host) {
|
|
|
57991
57994
|
return simplified !== type ? simplified : getConstraintOfType(type);
|
|
57992
57995
|
}
|
|
57993
57996
|
function getConstraintFromIndexedAccess(type) {
|
|
57994
|
-
if (isMappedTypeGenericIndexedAccess(type)) {
|
|
57997
|
+
if (isMappedTypeGenericIndexedAccess(type) || isGenericMappedType(type.objectType)) {
|
|
57995
57998
|
return substituteIndexedMappedType(type.objectType, type.indexType);
|
|
57996
57999
|
}
|
|
57997
58000
|
const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
|
|
@@ -60379,6 +60382,12 @@ function createTypeChecker(host) {
|
|
|
60379
60382
|
i--;
|
|
60380
60383
|
const source = types[i];
|
|
60381
60384
|
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
60385
|
+
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
60386
|
+
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
60387
|
+
orderedRemoveItemAt(types, i);
|
|
60388
|
+
}
|
|
60389
|
+
continue;
|
|
60390
|
+
}
|
|
60382
60391
|
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
60383
60392
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
60384
60393
|
for (const target of types) {
|
|
@@ -60946,7 +60955,7 @@ function createTypeChecker(host) {
|
|
|
60946
60955
|
links.resolvedType = getTypeFromTypeNode(node.type);
|
|
60947
60956
|
break;
|
|
60948
60957
|
default:
|
|
60949
|
-
|
|
60958
|
+
Debug.assertNever(node.operator);
|
|
60950
60959
|
}
|
|
60951
60960
|
}
|
|
60952
60961
|
return links.resolvedType;
|
|
@@ -61913,7 +61922,10 @@ function createTypeChecker(host) {
|
|
|
61913
61922
|
const declarations = concatenate(leftProp.declarations, rightProp.declarations);
|
|
61914
61923
|
const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */;
|
|
61915
61924
|
const result = createSymbol(flags, leftProp.escapedName);
|
|
61916
|
-
|
|
61925
|
+
const leftType = getTypeOfSymbol(leftProp);
|
|
61926
|
+
const leftTypeWithoutUndefined = removeMissingOrUndefinedType(leftType);
|
|
61927
|
+
const rightTypeWithoutUndefined = removeMissingOrUndefinedType(rightType);
|
|
61928
|
+
result.links.type = leftTypeWithoutUndefined === rightTypeWithoutUndefined ? leftType : getUnionType([leftType, rightTypeWithoutUndefined], 2 /* Subtype */);
|
|
61917
61929
|
result.links.leftSpread = leftProp;
|
|
61918
61930
|
result.links.rightSpread = rightProp;
|
|
61919
61931
|
result.declarations = declarations;
|
|
@@ -63336,6 +63348,9 @@ function createTypeChecker(host) {
|
|
|
63336
63348
|
const targetCount = getParameterCount(target);
|
|
63337
63349
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
63338
63350
|
if (sourceHasMoreParameters) {
|
|
63351
|
+
if (reportErrors2 && !(checkMode & 8 /* StrictArity */)) {
|
|
63352
|
+
errorReporter(Diagnostics.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1, getMinArgumentCount(source), targetCount);
|
|
63353
|
+
}
|
|
63339
63354
|
return 0 /* False */;
|
|
63340
63355
|
}
|
|
63341
63356
|
if (source.typeParameters && source.typeParameters !== target.typeParameters) {
|
|
@@ -65044,6 +65059,26 @@ function createTypeChecker(host) {
|
|
|
65044
65059
|
)) {
|
|
65045
65060
|
return result2;
|
|
65046
65061
|
}
|
|
65062
|
+
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
65063
|
+
const indexType = source2.indexType;
|
|
65064
|
+
if (indexType.flags & 4194304 /* Index */) {
|
|
65065
|
+
const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
|
|
65066
|
+
const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
|
|
65067
|
+
const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
|
|
65068
|
+
if (result2 = isRelatedTo(
|
|
65069
|
+
constraint2,
|
|
65070
|
+
target2,
|
|
65071
|
+
1 /* Source */,
|
|
65072
|
+
/*reportErrors*/
|
|
65073
|
+
false,
|
|
65074
|
+
/*headMessage*/
|
|
65075
|
+
void 0,
|
|
65076
|
+
intersectionState
|
|
65077
|
+
)) {
|
|
65078
|
+
return result2;
|
|
65079
|
+
}
|
|
65080
|
+
}
|
|
65081
|
+
}
|
|
65047
65082
|
if (isMappedTypeGenericIndexedAccess(source2)) {
|
|
65048
65083
|
const indexConstraint = getConstraintOfType(source2.indexType);
|
|
65049
65084
|
if (indexConstraint) {
|
|
@@ -66235,7 +66270,7 @@ function createTypeChecker(host) {
|
|
|
66235
66270
|
return type.symbol;
|
|
66236
66271
|
}
|
|
66237
66272
|
if (isTupleType(type)) {
|
|
66238
|
-
return type;
|
|
66273
|
+
return type.target;
|
|
66239
66274
|
}
|
|
66240
66275
|
}
|
|
66241
66276
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
@@ -67478,21 +67513,19 @@ function createTypeChecker(host) {
|
|
|
67478
67513
|
const saveInferencePriority = inferencePriority;
|
|
67479
67514
|
inferencePriority = 2048 /* MaxValue */;
|
|
67480
67515
|
const saveExpandingFlags = expandingFlags;
|
|
67481
|
-
|
|
67482
|
-
|
|
67483
|
-
if (
|
|
67516
|
+
(sourceStack != null ? sourceStack : sourceStack = []).push(source);
|
|
67517
|
+
(targetStack != null ? targetStack : targetStack = []).push(target);
|
|
67518
|
+
if (isDeeplyNestedType(source, sourceStack, sourceStack.length, 2))
|
|
67484
67519
|
expandingFlags |= 1 /* Source */;
|
|
67485
|
-
if (
|
|
67520
|
+
if (isDeeplyNestedType(target, targetStack, targetStack.length, 2))
|
|
67486
67521
|
expandingFlags |= 2 /* Target */;
|
|
67487
67522
|
if (expandingFlags !== 3 /* Both */) {
|
|
67488
|
-
(sourceStack || (sourceStack = [])).push(sourceIdentity);
|
|
67489
|
-
(targetStack || (targetStack = [])).push(targetIdentity);
|
|
67490
67523
|
action(source, target);
|
|
67491
|
-
targetStack.pop();
|
|
67492
|
-
sourceStack.pop();
|
|
67493
67524
|
} else {
|
|
67494
67525
|
inferencePriority = -1 /* Circularity */;
|
|
67495
67526
|
}
|
|
67527
|
+
targetStack.pop();
|
|
67528
|
+
sourceStack.pop();
|
|
67496
67529
|
expandingFlags = saveExpandingFlags;
|
|
67497
67530
|
visited.set(key, inferencePriority);
|
|
67498
67531
|
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
|
|
@@ -75220,7 +75253,7 @@ function createTypeChecker(host) {
|
|
|
75220
75253
|
case 283 /* JsxSelfClosingElement */:
|
|
75221
75254
|
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
|
|
75222
75255
|
}
|
|
75223
|
-
|
|
75256
|
+
Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
|
|
75224
75257
|
}
|
|
75225
75258
|
function getResolvedSignature(node, candidatesOutArray, checkMode) {
|
|
75226
75259
|
const links = getNodeLinks(node);
|
|
@@ -86495,7 +86528,7 @@ function createTypeChecker(host) {
|
|
|
86495
86528
|
currentKind = 2 /* SetAccessor */;
|
|
86496
86529
|
break;
|
|
86497
86530
|
default:
|
|
86498
|
-
|
|
86531
|
+
Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
|
|
86499
86532
|
}
|
|
86500
86533
|
if (!inDestructuring) {
|
|
86501
86534
|
const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
|
|
@@ -99377,10 +99410,13 @@ function transformJsx(context) {
|
|
|
99377
99410
|
return Debug.failBadSyntaxKind(node);
|
|
99378
99411
|
}
|
|
99379
99412
|
}
|
|
99413
|
+
function hasProto(obj) {
|
|
99414
|
+
return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
|
|
99415
|
+
}
|
|
99380
99416
|
function hasKeyAfterPropsSpread(node) {
|
|
99381
99417
|
let spread = false;
|
|
99382
99418
|
for (const elem of node.attributes.properties) {
|
|
99383
|
-
if (isJsxSpreadAttribute(elem)) {
|
|
99419
|
+
if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
|
|
99384
99420
|
spread = true;
|
|
99385
99421
|
} else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
|
|
99386
99422
|
return true;
|
|
@@ -99546,7 +99582,10 @@ function transformJsx(context) {
|
|
|
99546
99582
|
}
|
|
99547
99583
|
return element;
|
|
99548
99584
|
}
|
|
99549
|
-
function
|
|
99585
|
+
function transformJsxSpreadAttributeToProps(node) {
|
|
99586
|
+
if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
|
|
99587
|
+
return node.expression.properties;
|
|
99588
|
+
}
|
|
99550
99589
|
return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
|
|
99551
99590
|
}
|
|
99552
99591
|
function transformJsxAttributesToObjectProps(attrs, children) {
|
|
@@ -99554,30 +99593,48 @@ function transformJsx(context) {
|
|
|
99554
99593
|
return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
|
|
99555
99594
|
}
|
|
99556
99595
|
function transformJsxAttributesToProps(attrs, children) {
|
|
99557
|
-
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ?
|
|
99596
|
+
const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
|
|
99558
99597
|
if (children) {
|
|
99559
99598
|
props.push(children);
|
|
99560
99599
|
}
|
|
99561
99600
|
return props;
|
|
99562
99601
|
}
|
|
99563
99602
|
function transformJsxAttributesToExpression(attrs, children) {
|
|
99564
|
-
const expressions =
|
|
99565
|
-
|
|
99566
|
-
|
|
99567
|
-
|
|
99568
|
-
(
|
|
99569
|
-
|
|
99570
|
-
|
|
99571
|
-
|
|
99572
|
-
|
|
99603
|
+
const expressions = [];
|
|
99604
|
+
let properties = [];
|
|
99605
|
+
for (const attr of attrs) {
|
|
99606
|
+
if (isJsxSpreadAttribute(attr)) {
|
|
99607
|
+
if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
|
|
99608
|
+
for (const prop of attr.expression.properties) {
|
|
99609
|
+
if (isSpreadAssignment(prop)) {
|
|
99610
|
+
finishObjectLiteralIfNeeded();
|
|
99611
|
+
expressions.push(prop.expression);
|
|
99612
|
+
continue;
|
|
99613
|
+
}
|
|
99614
|
+
properties.push(prop);
|
|
99615
|
+
}
|
|
99616
|
+
continue;
|
|
99617
|
+
}
|
|
99618
|
+
finishObjectLiteralIfNeeded();
|
|
99619
|
+
expressions.push(attr.expression);
|
|
99620
|
+
continue;
|
|
99621
|
+
}
|
|
99622
|
+
properties.push(transformJsxAttributeToObjectLiteralElement(attr));
|
|
99573
99623
|
}
|
|
99574
99624
|
if (children) {
|
|
99575
|
-
|
|
99625
|
+
properties.push(children);
|
|
99626
|
+
}
|
|
99627
|
+
finishObjectLiteralIfNeeded();
|
|
99628
|
+
if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
|
|
99629
|
+
expressions.unshift(factory2.createObjectLiteralExpression());
|
|
99576
99630
|
}
|
|
99577
99631
|
return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
|
|
99578
|
-
|
|
99579
|
-
|
|
99580
|
-
|
|
99632
|
+
function finishObjectLiteralIfNeeded() {
|
|
99633
|
+
if (properties.length) {
|
|
99634
|
+
expressions.push(factory2.createObjectLiteralExpression(properties));
|
|
99635
|
+
properties = [];
|
|
99636
|
+
}
|
|
99637
|
+
}
|
|
99581
99638
|
}
|
|
99582
99639
|
function transformJsxAttributeToObjectLiteralElement(node) {
|
|
99583
99640
|
const name = getAttributeName(node);
|
|
@@ -120480,8 +120537,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120480
120537
|
if (!referenceInfo)
|
|
120481
120538
|
return void 0;
|
|
120482
120539
|
const { sourceFile, index } = referenceInfo;
|
|
120483
|
-
const referencesSyntax =
|
|
120484
|
-
|
|
120540
|
+
const referencesSyntax = forEachTsConfigPropArray(
|
|
120541
|
+
sourceFile,
|
|
120542
|
+
"references",
|
|
120485
120543
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
120486
120544
|
);
|
|
120487
120545
|
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
|
@@ -120552,26 +120610,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120552
120610
|
}
|
|
120553
120611
|
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
|
|
120554
120612
|
let needCompilerDiagnostic = true;
|
|
120555
|
-
|
|
120556
|
-
for (const pathProp of pathsSyntax) {
|
|
120613
|
+
forEachOptionPathsSyntax((pathProp) => {
|
|
120557
120614
|
if (isObjectLiteralExpression(pathProp.initializer)) {
|
|
120558
|
-
|
|
120615
|
+
forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
|
|
120559
120616
|
const initializer = keyProps.initializer;
|
|
120560
120617
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
|
120561
120618
|
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
|
120562
120619
|
needCompilerDiagnostic = false;
|
|
120563
120620
|
}
|
|
120564
|
-
}
|
|
120621
|
+
});
|
|
120565
120622
|
}
|
|
120566
|
-
}
|
|
120623
|
+
});
|
|
120567
120624
|
if (needCompilerDiagnostic) {
|
|
120568
120625
|
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120569
120626
|
}
|
|
120570
120627
|
}
|
|
120571
120628
|
function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
|
|
120572
120629
|
let needCompilerDiagnostic = true;
|
|
120573
|
-
|
|
120574
|
-
for (const pathProp of pathsSyntax) {
|
|
120630
|
+
forEachOptionPathsSyntax((pathProp) => {
|
|
120575
120631
|
if (isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax(
|
|
120576
120632
|
pathProp.initializer,
|
|
120577
120633
|
onKey,
|
|
@@ -120583,21 +120639,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120583
120639
|
)) {
|
|
120584
120640
|
needCompilerDiagnostic = false;
|
|
120585
120641
|
}
|
|
120586
|
-
}
|
|
120642
|
+
});
|
|
120587
120643
|
if (needCompilerDiagnostic) {
|
|
120588
120644
|
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120589
120645
|
}
|
|
120590
120646
|
}
|
|
120591
|
-
function
|
|
120592
|
-
|
|
120593
|
-
return compilerOptionsObjectLiteralSyntax && getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name);
|
|
120647
|
+
function forEachOptionsSyntaxByName(name, callback) {
|
|
120648
|
+
return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
|
|
120594
120649
|
}
|
|
120595
|
-
function
|
|
120596
|
-
return
|
|
120650
|
+
function forEachOptionPathsSyntax(callback) {
|
|
120651
|
+
return forEachOptionsSyntaxByName("paths", callback);
|
|
120597
120652
|
}
|
|
120598
120653
|
function getOptionsSyntaxByValue(name, value) {
|
|
120599
|
-
|
|
120600
|
-
return syntaxByName && firstDefined(syntaxByName, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
|
120654
|
+
return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
|
120601
120655
|
}
|
|
120602
120656
|
function getOptionsSyntaxByArrayElementValue(name, value) {
|
|
120603
120657
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
@@ -120627,8 +120681,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120627
120681
|
);
|
|
120628
120682
|
}
|
|
120629
120683
|
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
120630
|
-
const referencesSyntax =
|
|
120631
|
-
|
|
120684
|
+
const referencesSyntax = forEachTsConfigPropArray(
|
|
120685
|
+
sourceFile || options.configFile,
|
|
120686
|
+
"references",
|
|
120632
120687
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
120633
120688
|
);
|
|
120634
120689
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
@@ -120650,29 +120705,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120650
120705
|
}
|
|
120651
120706
|
function getCompilerOptionsObjectLiteralSyntax() {
|
|
120652
120707
|
if (_compilerOptionsObjectLiteralSyntax === void 0) {
|
|
120653
|
-
_compilerOptionsObjectLiteralSyntax =
|
|
120654
|
-
|
|
120655
|
-
|
|
120656
|
-
|
|
120657
|
-
|
|
120658
|
-
_compilerOptionsObjectLiteralSyntax = prop.initializer;
|
|
120659
|
-
break;
|
|
120660
|
-
}
|
|
120661
|
-
}
|
|
120662
|
-
}
|
|
120708
|
+
_compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
|
|
120709
|
+
getTsConfigObjectLiteralExpression(options.configFile),
|
|
120710
|
+
"compilerOptions",
|
|
120711
|
+
(prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
|
|
120712
|
+
) || false;
|
|
120663
120713
|
}
|
|
120664
120714
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
120665
120715
|
}
|
|
120666
120716
|
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
|
|
120667
|
-
|
|
120668
|
-
|
|
120717
|
+
let needsCompilerDiagnostic = false;
|
|
120718
|
+
forEachPropertyAssignment(objectLiteral, key1, (prop) => {
|
|
120669
120719
|
if ("messageText" in message) {
|
|
120670
120720
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
120671
120721
|
} else {
|
|
120672
120722
|
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
|
120673
120723
|
}
|
|
120674
|
-
|
|
120675
|
-
|
|
120724
|
+
needsCompilerDiagnostic = true;
|
|
120725
|
+
}, key2);
|
|
120726
|
+
return needsCompilerDiagnostic;
|
|
120676
120727
|
}
|
|
120677
120728
|
function createRedundantOptionDiagnostic(errorOnOption, redundantWithOption) {
|
|
120678
120729
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
@@ -127226,7 +127277,7 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
|
|
|
127226
127277
|
case 0 /* Ok */:
|
|
127227
127278
|
return Debug.fail();
|
|
127228
127279
|
default:
|
|
127229
|
-
|
|
127280
|
+
Debug.assertNever(result);
|
|
127230
127281
|
}
|
|
127231
127282
|
}
|
|
127232
127283
|
|
|
@@ -128963,6 +129014,7 @@ var typeKeywords = [
|
|
|
128963
129014
|
147 /* ReadonlyKeyword */,
|
|
128964
129015
|
153 /* StringKeyword */,
|
|
128965
129016
|
154 /* SymbolKeyword */,
|
|
129017
|
+
113 /* TypeOfKeyword */,
|
|
128966
129018
|
111 /* TrueKeyword */,
|
|
128967
129019
|
115 /* VoidKeyword */,
|
|
128968
129020
|
156 /* UndefinedKeyword */,
|
|
@@ -148046,7 +148098,7 @@ function getInfo14(sourceFile, program, pos) {
|
|
|
148046
148098
|
/*checkArgumentIsStringLiteralLike*/
|
|
148047
148099
|
true
|
|
148048
148100
|
)) {
|
|
148049
|
-
|
|
148101
|
+
Debug.failBadSyntaxKind(parent2);
|
|
148050
148102
|
}
|
|
148051
148103
|
const decl = cast(parent2.parent, isVariableDeclaration);
|
|
148052
148104
|
const defaultImportName = tryCast(decl.name, isIdentifier);
|
|
@@ -149755,7 +149807,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
|
|
|
149755
149807
|
}
|
|
149756
149808
|
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
149757
149809
|
const replacementSpan = importStatementCompletion.replacementSpan;
|
|
149758
|
-
const quotedModuleSpecifier = quote(sourceFile, preferences,
|
|
149810
|
+
const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
|
|
149759
149811
|
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
|
|
149760
149812
|
const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
149761
149813
|
const importKind = ts_codefix_exports.getImportKind(
|
|
@@ -151351,7 +151403,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
151351
151403
|
return true;
|
|
151352
151404
|
}
|
|
151353
151405
|
}
|
|
151354
|
-
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !(isClassLike(contextToken2.parent) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
151406
|
+
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
151355
151407
|
}
|
|
151356
151408
|
function isPreviousPropertyDeclarationTerminated(contextToken2, position2) {
|
|
151357
151409
|
return contextToken2.kind !== 63 /* EqualsToken */ && (contextToken2.kind === 26 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile));
|
|
@@ -161276,7 +161328,7 @@ function getDescriptionForFunctionLikeDeclaration(scope) {
|
|
|
161276
161328
|
case 176 /* SetAccessor */:
|
|
161277
161329
|
return `'set ${scope.name.getText()}'`;
|
|
161278
161330
|
default:
|
|
161279
|
-
|
|
161331
|
+
Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`);
|
|
161280
161332
|
}
|
|
161281
161333
|
}
|
|
161282
161334
|
function getDescriptionForClassLikeDeclaration(scope) {
|
|
@@ -168565,10 +168617,12 @@ __export(ts_exports2, {
|
|
|
168565
168617
|
forEachKey: () => forEachKey,
|
|
168566
168618
|
forEachLeadingCommentRange: () => forEachLeadingCommentRange,
|
|
168567
168619
|
forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
|
|
168620
|
+
forEachPropertyAssignment: () => forEachPropertyAssignment,
|
|
168568
168621
|
forEachResolvedProjectReference: () => forEachResolvedProjectReference,
|
|
168569
168622
|
forEachReturnStatement: () => forEachReturnStatement,
|
|
168570
168623
|
forEachRight: () => forEachRight,
|
|
168571
168624
|
forEachTrailingCommentRange: () => forEachTrailingCommentRange,
|
|
168625
|
+
forEachTsConfigPropArray: () => forEachTsConfigPropArray,
|
|
168572
168626
|
forEachUnique: () => forEachUnique,
|
|
168573
168627
|
forEachYieldExpression: () => forEachYieldExpression,
|
|
168574
168628
|
forSomeAncestorDirectory: () => forSomeAncestorDirectory,
|
|
@@ -168901,7 +168955,6 @@ __export(ts_exports2, {
|
|
|
168901
168955
|
getProperties: () => getProperties,
|
|
168902
168956
|
getProperty: () => getProperty,
|
|
168903
168957
|
getPropertyArrayElementValue: () => getPropertyArrayElementValue,
|
|
168904
|
-
getPropertyAssignment: () => getPropertyAssignment,
|
|
168905
168958
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
|
168906
168959
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
|
168907
168960
|
getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
|
|
@@ -169006,7 +169059,6 @@ __export(ts_exports2, {
|
|
|
169006
169059
|
getTransformers: () => getTransformers,
|
|
169007
169060
|
getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
|
|
169008
169061
|
getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
|
|
169009
|
-
getTsConfigPropArray: () => getTsConfigPropArray,
|
|
169010
169062
|
getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
|
|
169011
169063
|
getTypeAnnotationNode: () => getTypeAnnotationNode,
|
|
169012
169064
|
getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,
|
|
@@ -182531,10 +182583,12 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182531
182583
|
forEachKey,
|
|
182532
182584
|
forEachLeadingCommentRange,
|
|
182533
182585
|
forEachNameInAccessChainWalkingLeft,
|
|
182586
|
+
forEachPropertyAssignment,
|
|
182534
182587
|
forEachResolvedProjectReference,
|
|
182535
182588
|
forEachReturnStatement,
|
|
182536
182589
|
forEachRight,
|
|
182537
182590
|
forEachTrailingCommentRange,
|
|
182591
|
+
forEachTsConfigPropArray,
|
|
182538
182592
|
forEachUnique,
|
|
182539
182593
|
forEachYieldExpression,
|
|
182540
182594
|
forSomeAncestorDirectory,
|
|
@@ -182867,7 +182921,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182867
182921
|
getProperties,
|
|
182868
182922
|
getProperty,
|
|
182869
182923
|
getPropertyArrayElementValue,
|
|
182870
|
-
getPropertyAssignment,
|
|
182871
182924
|
getPropertyAssignmentAliasLikeExpression,
|
|
182872
182925
|
getPropertyNameForPropertyNameNode,
|
|
182873
182926
|
getPropertyNameForUniqueESSymbol,
|
|
@@ -182972,7 +183025,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182972
183025
|
getTransformers,
|
|
182973
183026
|
getTsBuildInfoEmitOutputFilePath,
|
|
182974
183027
|
getTsConfigObjectLiteralExpression,
|
|
182975
|
-
getTsConfigPropArray,
|
|
182976
183028
|
getTsConfigPropArrayElementValue,
|
|
182977
183029
|
getTypeAnnotationNode,
|
|
182978
183030
|
getTypeArgumentOrTypeParameterList,
|