typescript 4.8.0-dev.20220725 → 4.8.0-dev.20220728
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.proxy.d.ts +91 -2
- package/lib/tsc.js +19 -9
- package/lib/tsserver.js +143 -27
- package/lib/tsserverlibrary.js +143 -27
- package/lib/typescript.js +143 -27
- package/lib/typescriptServices.js +143 -27
- package/lib/typingsInstaller.js +24 -11
- package/package.json +4 -3
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220728";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8762,6 +8762,7 @@ var ts;
|
|
|
8762
8762
|
Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
|
|
8763
8763
|
auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
|
|
8764
8764
|
An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
|
|
8765
|
+
Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
|
|
8765
8766
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8766
8767
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8767
8768
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -33501,7 +33502,9 @@ var ts;
|
|
|
33501
33502
|
case 23 /* ImportOrExportSpecifiers */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
|
|
33502
33503
|
case 13 /* JsxAttributes */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
|
|
33503
33504
|
case 14 /* JsxChildren */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
|
|
33504
|
-
|
|
33505
|
+
case 24 /* AssertEntries */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_or_string_literal_expected); // AssertionKey.
|
|
33506
|
+
case 25 /* Count */: return ts.Debug.fail("ParsingContext.Count used as a context"); // Not a real context, only a marker.
|
|
33507
|
+
default: ts.Debug.assertNever(context);
|
|
33505
33508
|
}
|
|
33506
33509
|
}
|
|
33507
33510
|
function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
|
|
@@ -33942,7 +33945,7 @@ var ts;
|
|
|
33942
33945
|
// FormalParameter [Yield,Await]:
|
|
33943
33946
|
// BindingElement[?Yield,?Await]
|
|
33944
33947
|
// Decorators are parsed in the outer [Await] context, the rest of the parameter is parsed in the function's [Await] context.
|
|
33945
|
-
var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : parseDecorators
|
|
33948
|
+
var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : doOutsideOfAwaitContext(parseDecorators);
|
|
33946
33949
|
if (token() === 108 /* ThisKeyword */) {
|
|
33947
33950
|
var node_1 = factory.createParameterDeclaration(decorators,
|
|
33948
33951
|
/*dotDotDotToken*/ undefined, createIdentifier(/*isIdentifier*/ true),
|
|
@@ -59607,7 +59610,8 @@ var ts;
|
|
|
59607
59610
|
}
|
|
59608
59611
|
}
|
|
59609
59612
|
}
|
|
59610
|
-
|
|
59613
|
+
// The source types were normalized; ensure the result is normalized too.
|
|
59614
|
+
return getNormalizedType(getIntersectionType(constraints), /*writing*/ false);
|
|
59611
59615
|
}
|
|
59612
59616
|
return undefined;
|
|
59613
59617
|
}
|
|
@@ -72133,8 +72137,12 @@ var ts;
|
|
|
72133
72137
|
var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
72134
72138
|
var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
72135
72139
|
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
72136
|
-
// specific of the two.
|
|
72137
|
-
|
|
72140
|
+
// specific of the two. When t and c are related in both directions, we prefer c for type predicates
|
|
72141
|
+
// because that is the asserted type, but t for `instanceof` because generics aren't reflected in
|
|
72142
|
+
// prototype object types.
|
|
72143
|
+
var directlyRelated = mapType(matching || type, checkDerived ?
|
|
72144
|
+
function (t) { return isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType; } :
|
|
72145
|
+
function (t) { return isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType; });
|
|
72138
72146
|
// If no constituents are directly related, create intersections for any generic constituents that
|
|
72139
72147
|
// are related by constraint.
|
|
72140
72148
|
return directlyRelated.flags & 131072 /* Never */ ?
|
|
@@ -84846,8 +84854,9 @@ var ts;
|
|
|
84846
84854
|
}
|
|
84847
84855
|
var indexInfos = getApplicableIndexInfos(type, propNameType);
|
|
84848
84856
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84849
|
-
var
|
|
84850
|
-
name && name.kind === 162 /* ComputedPropertyName */
|
|
84857
|
+
var propDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84858
|
+
name && name.kind === 162 /* ComputedPropertyName */ ? declaration : undefined;
|
|
84859
|
+
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84851
84860
|
var _loop_30 = function (info) {
|
|
84852
84861
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84853
84862
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
@@ -84856,7 +84865,11 @@ var ts;
|
|
|
84856
84865
|
var errorNode = localPropDeclaration || localIndexDeclaration ||
|
|
84857
84866
|
(interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
|
|
84858
84867
|
if (errorNode && !isTypeAssignableTo(propType, info.type)) {
|
|
84859
|
-
|
|
84868
|
+
var diagnostic = createError(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
|
|
84869
|
+
if (propDeclaration && errorNode !== propDeclaration) {
|
|
84870
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(propDeclaration, ts.Diagnostics._0_is_declared_here, symbolToString(prop)));
|
|
84871
|
+
}
|
|
84872
|
+
diagnostics.add(diagnostic);
|
|
84860
84873
|
}
|
|
84861
84874
|
};
|
|
84862
84875
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
@@ -90753,7 +90766,7 @@ var ts;
|
|
|
90753
90766
|
return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine);
|
|
90754
90767
|
case 197 /* NamedTupleMember */:
|
|
90755
90768
|
ts.Debug.type(node);
|
|
90756
|
-
return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken,
|
|
90769
|
+
return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode));
|
|
90757
90770
|
case 191 /* ParenthesizedType */:
|
|
90758
90771
|
ts.Debug.type(node);
|
|
90759
90772
|
return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode));
|
|
@@ -118507,7 +118520,7 @@ var ts;
|
|
|
118507
118520
|
// `result[i]` is either a `ResolvedModuleFull` or a marker.
|
|
118508
118521
|
// If it is the former, we can leave it as is.
|
|
118509
118522
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
118510
|
-
result[i] = undefined;
|
|
118523
|
+
result[i] = undefined;
|
|
118511
118524
|
}
|
|
118512
118525
|
}
|
|
118513
118526
|
else {
|
|
@@ -155993,8 +156006,7 @@ var ts;
|
|
|
155993
156006
|
codefix.eachDiagnostic(context, errorCodes, function (diag) {
|
|
155994
156007
|
var info = getInfo(program, diag.file, ts.createTextSpan(diag.start, diag.length));
|
|
155995
156008
|
if (info) {
|
|
155996
|
-
|
|
155997
|
-
if (ts.addToSeen(seen, id)) {
|
|
156009
|
+
if (ts.addToSeen(seen, ts.getNodeId(info.declaration))) {
|
|
155998
156010
|
return addMissingConstraint(changes, program, preferences, host, diag.file, info);
|
|
155999
156011
|
}
|
|
156000
156012
|
}
|
|
@@ -159962,21 +159974,16 @@ var ts;
|
|
|
159962
159974
|
var names = ts.map(args, function (arg) {
|
|
159963
159975
|
return ts.isIdentifier(arg) ? arg.text : ts.isPropertyAccessExpression(arg) && ts.isIdentifier(arg.name) ? arg.name.text : undefined;
|
|
159964
159976
|
});
|
|
159965
|
-
var
|
|
159966
|
-
|
|
159967
|
-
});
|
|
159977
|
+
var instanceTypes = isJs ? [] : ts.map(args, function (arg) { return checker.getTypeAtLocation(arg); });
|
|
159978
|
+
var _a = getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, /*flags*/ undefined, tracker), argumentTypeNodes = _a.argumentTypeNodes, argumentTypeParameters = _a.argumentTypeParameters;
|
|
159968
159979
|
var modifiers = modifierFlags
|
|
159969
159980
|
? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags))
|
|
159970
159981
|
: undefined;
|
|
159971
159982
|
var asteriskToken = ts.isYieldExpression(parent)
|
|
159972
159983
|
? ts.factory.createToken(41 /* AsteriskToken */)
|
|
159973
159984
|
: undefined;
|
|
159974
|
-
var typeParameters = isJs
|
|
159975
|
-
|
|
159976
|
-
: ts.map(typeArguments, function (_, i) {
|
|
159977
|
-
return ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, 84 /* T */ + typeArguments.length - 1 <= 90 /* Z */ ? String.fromCharCode(84 /* T */ + i) : "T" + i);
|
|
159978
|
-
});
|
|
159979
|
-
var parameters = createDummyParameters(args.length, names, types, /*minArgumentCount*/ undefined, isJs);
|
|
159985
|
+
var typeParameters = isJs ? undefined : createTypeParametersForArguments(checker, argumentTypeParameters, typeArguments);
|
|
159986
|
+
var parameters = createDummyParameters(args.length, names, argumentTypeNodes, /*minArgumentCount*/ undefined, isJs);
|
|
159980
159987
|
var type = isJs || contextualType === undefined
|
|
159981
159988
|
? undefined
|
|
159982
159989
|
: checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker);
|
|
@@ -159994,6 +160001,23 @@ var ts;
|
|
|
159994
160001
|
}
|
|
159995
160002
|
}
|
|
159996
160003
|
codefix.createSignatureDeclarationFromCallExpression = createSignatureDeclarationFromCallExpression;
|
|
160004
|
+
function createTypeParametersForArguments(checker, argumentTypeParameters, typeArguments) {
|
|
160005
|
+
var usedNames = new ts.Set(argumentTypeParameters.map(function (pair) { return pair[0]; }));
|
|
160006
|
+
var constraintsByName = new ts.Map(argumentTypeParameters);
|
|
160007
|
+
if (typeArguments) {
|
|
160008
|
+
var typeArgumentsWithNewTypes = typeArguments.filter(function (typeArgument) { return !argumentTypeParameters.some(function (pair) { var _a; return checker.getTypeAtLocation(typeArgument) === ((_a = pair[1]) === null || _a === void 0 ? void 0 : _a.argumentType); }); });
|
|
160009
|
+
var targetSize = usedNames.size + typeArgumentsWithNewTypes.length;
|
|
160010
|
+
for (var i = 0; usedNames.size < targetSize; i += 1) {
|
|
160011
|
+
usedNames.add(createTypeParameterName(i));
|
|
160012
|
+
}
|
|
160013
|
+
}
|
|
160014
|
+
return ts.map(ts.arrayFrom(usedNames.values()), function (usedName) { var _a; return ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, usedName, (_a = constraintsByName.get(usedName)) === null || _a === void 0 ? void 0 : _a.constraint); });
|
|
160015
|
+
}
|
|
160016
|
+
function createTypeParameterName(index) {
|
|
160017
|
+
return 84 /* T */ + index <= 90 /* Z */
|
|
160018
|
+
? String.fromCharCode(84 /* T */ + index)
|
|
160019
|
+
: "T" + index;
|
|
160020
|
+
}
|
|
159997
160021
|
function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, tracker) {
|
|
159998
160022
|
var typeNode = checker.typeToTypeNode(type, contextNode, flags, tracker);
|
|
159999
160023
|
if (typeNode && ts.isImportTypeNode(typeNode)) {
|
|
@@ -160007,15 +160031,107 @@ var ts;
|
|
|
160007
160031
|
return ts.getSynthesizedDeepClone(typeNode);
|
|
160008
160032
|
}
|
|
160009
160033
|
codefix.typeToAutoImportableTypeNode = typeToAutoImportableTypeNode;
|
|
160034
|
+
function typeContainsTypeParameter(type) {
|
|
160035
|
+
if (type.isUnionOrIntersection()) {
|
|
160036
|
+
return type.types.some(typeContainsTypeParameter);
|
|
160037
|
+
}
|
|
160038
|
+
return type.flags & 262144 /* TypeParameter */;
|
|
160039
|
+
}
|
|
160040
|
+
function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, tracker) {
|
|
160041
|
+
// Types to be used as the types of the parameters in the new function
|
|
160042
|
+
// E.g. from this source:
|
|
160043
|
+
// added("", 0)
|
|
160044
|
+
// The value will look like:
|
|
160045
|
+
// [{ typeName: { text: "string" } }, { typeName: { text: "number" }]
|
|
160046
|
+
// And in the output function will generate:
|
|
160047
|
+
// function added(a: string, b: number) { ... }
|
|
160048
|
+
var argumentTypeNodes = [];
|
|
160049
|
+
// Names of type parameters provided as arguments to the call
|
|
160050
|
+
// E.g. from this source:
|
|
160051
|
+
// added<T, U>(value);
|
|
160052
|
+
// The value will look like:
|
|
160053
|
+
// [
|
|
160054
|
+
// ["T", { argumentType: { typeName: { text: "T" } } } ],
|
|
160055
|
+
// ["U", { argumentType: { typeName: { text: "U" } } } ],
|
|
160056
|
+
// ]
|
|
160057
|
+
// And in the output function will generate:
|
|
160058
|
+
// function added<T, U>() { ... }
|
|
160059
|
+
var argumentTypeParameters = new ts.Map();
|
|
160060
|
+
for (var i = 0; i < instanceTypes.length; i += 1) {
|
|
160061
|
+
var instanceType = instanceTypes[i];
|
|
160062
|
+
// If the instance type contains a deep reference to an existing type parameter,
|
|
160063
|
+
// instead of copying the full union or intersection, create a new type parameter
|
|
160064
|
+
// E.g. from this source:
|
|
160065
|
+
// function existing<T, U>(value: T | U & string) {
|
|
160066
|
+
// added/*1*/(value);
|
|
160067
|
+
// We don't want to output this:
|
|
160068
|
+
// function added<T>(value: T | U & string) { ... }
|
|
160069
|
+
// We instead want to output:
|
|
160070
|
+
// function added<T>(value: T) { ... }
|
|
160071
|
+
if (instanceType.isUnionOrIntersection() && instanceType.types.some(typeContainsTypeParameter)) {
|
|
160072
|
+
var synthesizedTypeParameterName = createTypeParameterName(i);
|
|
160073
|
+
argumentTypeNodes.push(ts.factory.createTypeReferenceNode(synthesizedTypeParameterName));
|
|
160074
|
+
argumentTypeParameters.set(synthesizedTypeParameterName, undefined);
|
|
160075
|
+
continue;
|
|
160076
|
+
}
|
|
160077
|
+
// Widen the type so we don't emit nonsense annotations like "function fn(x: 3) {"
|
|
160078
|
+
var widenedInstanceType = checker.getBaseTypeOfLiteralType(instanceType);
|
|
160079
|
+
var argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, scriptTarget, flags, tracker);
|
|
160080
|
+
if (!argumentTypeNode) {
|
|
160081
|
+
continue;
|
|
160082
|
+
}
|
|
160083
|
+
argumentTypeNodes.push(argumentTypeNode);
|
|
160084
|
+
var argumentTypeParameter = getFirstTypeParameterName(instanceType);
|
|
160085
|
+
// If the instance type is a type parameter with a constraint (other than an anonymous object),
|
|
160086
|
+
// remember that constraint for when we create the new type parameter
|
|
160087
|
+
// E.g. from this source:
|
|
160088
|
+
// function existing<T extends string>(value: T) {
|
|
160089
|
+
// added/*1*/(value);
|
|
160090
|
+
// We don't want to output this:
|
|
160091
|
+
// function added<T>(value: T) { ... }
|
|
160092
|
+
// We instead want to output:
|
|
160093
|
+
// function added<T extends string>(value: T) { ... }
|
|
160094
|
+
var instanceTypeConstraint = instanceType.isTypeParameter() && instanceType.constraint && !isAnonymousObjectConstraintType(instanceType.constraint)
|
|
160095
|
+
? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, scriptTarget, flags, tracker)
|
|
160096
|
+
: undefined;
|
|
160097
|
+
if (argumentTypeParameter) {
|
|
160098
|
+
argumentTypeParameters.set(argumentTypeParameter, { argumentType: instanceType, constraint: instanceTypeConstraint });
|
|
160099
|
+
}
|
|
160100
|
+
}
|
|
160101
|
+
return { argumentTypeNodes: argumentTypeNodes, argumentTypeParameters: ts.arrayFrom(argumentTypeParameters.entries()) };
|
|
160102
|
+
}
|
|
160103
|
+
codefix.getArgumentTypesAndTypeParameters = getArgumentTypesAndTypeParameters;
|
|
160104
|
+
function isAnonymousObjectConstraintType(type) {
|
|
160105
|
+
return (type.flags & 524288 /* Object */) && type.objectFlags === 16 /* Anonymous */;
|
|
160106
|
+
}
|
|
160107
|
+
function getFirstTypeParameterName(type) {
|
|
160108
|
+
var _a;
|
|
160109
|
+
if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) {
|
|
160110
|
+
for (var _i = 0, _b = type.types; _i < _b.length; _i++) {
|
|
160111
|
+
var subType = _b[_i];
|
|
160112
|
+
var subTypeName = getFirstTypeParameterName(subType);
|
|
160113
|
+
if (subTypeName) {
|
|
160114
|
+
return subTypeName;
|
|
160115
|
+
}
|
|
160116
|
+
}
|
|
160117
|
+
}
|
|
160118
|
+
return type.flags & 262144 /* TypeParameter */
|
|
160119
|
+
? (_a = type.getSymbol()) === null || _a === void 0 ? void 0 : _a.getName()
|
|
160120
|
+
: undefined;
|
|
160121
|
+
}
|
|
160010
160122
|
function createDummyParameters(argCount, names, types, minArgumentCount, inJs) {
|
|
160011
160123
|
var parameters = [];
|
|
160124
|
+
var parameterNameCounts = new ts.Map();
|
|
160012
160125
|
for (var i = 0; i < argCount; i++) {
|
|
160126
|
+
var parameterName = (names === null || names === void 0 ? void 0 : names[i]) || "arg" + i;
|
|
160127
|
+
var parameterNameCount = parameterNameCounts.get(parameterName);
|
|
160128
|
+
parameterNameCounts.set(parameterName, (parameterNameCount || 0) + 1);
|
|
160013
160129
|
var newParameter = ts.factory.createParameterDeclaration(
|
|
160014
160130
|
/*modifiers*/ undefined,
|
|
160015
160131
|
/*dotDotDotToken*/ undefined,
|
|
160016
|
-
/*name*/
|
|
160132
|
+
/*name*/ parameterName + (parameterNameCount || ""),
|
|
160017
160133
|
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* QuestionToken */) : undefined,
|
|
160018
|
-
/*type*/ inJs ? undefined : types
|
|
160134
|
+
/*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */),
|
|
160019
160135
|
/*initializer*/ undefined);
|
|
160020
160136
|
parameters.push(newParameter);
|
|
160021
160137
|
}
|
|
@@ -164147,7 +164263,7 @@ var ts;
|
|
|
164147
164263
|
var usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
164148
164264
|
var currentDirectory = ts.getDirectoryPath(oldFile.fileName);
|
|
164149
164265
|
var extension = ts.extensionFromPath(oldFile.fileName);
|
|
164150
|
-
var newModuleName = makeUniqueModuleName(getNewModuleName(usage.movedSymbols), extension, currentDirectory, host);
|
|
164266
|
+
var newModuleName = makeUniqueModuleName(getNewModuleName(usage.oldFileImportsFromNewFile, usage.movedSymbols), extension, currentDirectory, host);
|
|
164151
164267
|
var newFileNameWithExtension = newModuleName + extension;
|
|
164152
164268
|
// If previous file was global, this is easy.
|
|
164153
164269
|
changes.createNewFile(oldFile, ts.combinePaths(currentDirectory, newFileNameWithExtension), getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences));
|
|
@@ -164511,8 +164627,8 @@ var ts;
|
|
|
164511
164627
|
newModuleName = moduleName + "." + i;
|
|
164512
164628
|
}
|
|
164513
164629
|
}
|
|
164514
|
-
function getNewModuleName(movedSymbols) {
|
|
164515
|
-
return movedSymbols.forEachEntry(ts.symbolNameNoDefault) || "newFile";
|
|
164630
|
+
function getNewModuleName(importsFromNewFile, movedSymbols) {
|
|
164631
|
+
return importsFromNewFile.forEachEntry(ts.symbolNameNoDefault) || movedSymbols.forEachEntry(ts.symbolNameNoDefault) || "newFile";
|
|
164516
164632
|
}
|
|
164517
164633
|
function getUsageInfo(oldFile, toMove, checker) {
|
|
164518
164634
|
var movedSymbols = new SymbolSet();
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220728";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8557,6 +8557,7 @@ var ts;
|
|
|
8557
8557
|
Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
|
|
8558
8558
|
auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
|
|
8559
8559
|
An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
|
|
8560
|
+
Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
|
|
8560
8561
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8561
8562
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8562
8563
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -33296,7 +33297,9 @@ var ts;
|
|
|
33296
33297
|
case 23 /* ImportOrExportSpecifiers */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
|
|
33297
33298
|
case 13 /* JsxAttributes */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
|
|
33298
33299
|
case 14 /* JsxChildren */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
|
|
33299
|
-
|
|
33300
|
+
case 24 /* AssertEntries */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_or_string_literal_expected); // AssertionKey.
|
|
33301
|
+
case 25 /* Count */: return ts.Debug.fail("ParsingContext.Count used as a context"); // Not a real context, only a marker.
|
|
33302
|
+
default: ts.Debug.assertNever(context);
|
|
33300
33303
|
}
|
|
33301
33304
|
}
|
|
33302
33305
|
function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
|
|
@@ -33737,7 +33740,7 @@ var ts;
|
|
|
33737
33740
|
// FormalParameter [Yield,Await]:
|
|
33738
33741
|
// BindingElement[?Yield,?Await]
|
|
33739
33742
|
// Decorators are parsed in the outer [Await] context, the rest of the parameter is parsed in the function's [Await] context.
|
|
33740
|
-
var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : parseDecorators
|
|
33743
|
+
var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : doOutsideOfAwaitContext(parseDecorators);
|
|
33741
33744
|
if (token() === 108 /* ThisKeyword */) {
|
|
33742
33745
|
var node_1 = factory.createParameterDeclaration(decorators,
|
|
33743
33746
|
/*dotDotDotToken*/ undefined, createIdentifier(/*isIdentifier*/ true),
|
|
@@ -59402,7 +59405,8 @@ var ts;
|
|
|
59402
59405
|
}
|
|
59403
59406
|
}
|
|
59404
59407
|
}
|
|
59405
|
-
|
|
59408
|
+
// The source types were normalized; ensure the result is normalized too.
|
|
59409
|
+
return getNormalizedType(getIntersectionType(constraints), /*writing*/ false);
|
|
59406
59410
|
}
|
|
59407
59411
|
return undefined;
|
|
59408
59412
|
}
|
|
@@ -71928,8 +71932,12 @@ var ts;
|
|
|
71928
71932
|
var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
71929
71933
|
var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
71930
71934
|
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
71931
|
-
// specific of the two.
|
|
71932
|
-
|
|
71935
|
+
// specific of the two. When t and c are related in both directions, we prefer c for type predicates
|
|
71936
|
+
// because that is the asserted type, but t for `instanceof` because generics aren't reflected in
|
|
71937
|
+
// prototype object types.
|
|
71938
|
+
var directlyRelated = mapType(matching || type, checkDerived ?
|
|
71939
|
+
function (t) { return isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType; } :
|
|
71940
|
+
function (t) { return isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType; });
|
|
71933
71941
|
// If no constituents are directly related, create intersections for any generic constituents that
|
|
71934
71942
|
// are related by constraint.
|
|
71935
71943
|
return directlyRelated.flags & 131072 /* Never */ ?
|
|
@@ -84641,8 +84649,9 @@ var ts;
|
|
|
84641
84649
|
}
|
|
84642
84650
|
var indexInfos = getApplicableIndexInfos(type, propNameType);
|
|
84643
84651
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84644
|
-
var
|
|
84645
|
-
name && name.kind === 162 /* ComputedPropertyName */
|
|
84652
|
+
var propDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84653
|
+
name && name.kind === 162 /* ComputedPropertyName */ ? declaration : undefined;
|
|
84654
|
+
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84646
84655
|
var _loop_30 = function (info) {
|
|
84647
84656
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84648
84657
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
@@ -84651,7 +84660,11 @@ var ts;
|
|
|
84651
84660
|
var errorNode = localPropDeclaration || localIndexDeclaration ||
|
|
84652
84661
|
(interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
|
|
84653
84662
|
if (errorNode && !isTypeAssignableTo(propType, info.type)) {
|
|
84654
|
-
|
|
84663
|
+
var diagnostic = createError(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
|
|
84664
|
+
if (propDeclaration && errorNode !== propDeclaration) {
|
|
84665
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(propDeclaration, ts.Diagnostics._0_is_declared_here, symbolToString(prop)));
|
|
84666
|
+
}
|
|
84667
|
+
diagnostics.add(diagnostic);
|
|
84655
84668
|
}
|
|
84656
84669
|
};
|
|
84657
84670
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
@@ -90548,7 +90561,7 @@ var ts;
|
|
|
90548
90561
|
return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine);
|
|
90549
90562
|
case 197 /* NamedTupleMember */:
|
|
90550
90563
|
ts.Debug.type(node);
|
|
90551
|
-
return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken,
|
|
90564
|
+
return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode));
|
|
90552
90565
|
case 191 /* ParenthesizedType */:
|
|
90553
90566
|
ts.Debug.type(node);
|
|
90554
90567
|
return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode));
|
|
@@ -118302,7 +118315,7 @@ var ts;
|
|
|
118302
118315
|
// `result[i]` is either a `ResolvedModuleFull` or a marker.
|
|
118303
118316
|
// If it is the former, we can leave it as is.
|
|
118304
118317
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
118305
|
-
result[i] = undefined;
|
|
118318
|
+
result[i] = undefined;
|
|
118306
118319
|
}
|
|
118307
118320
|
}
|
|
118308
118321
|
else {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.8.0-dev.
|
|
5
|
+
"version": "4.8.0-dev.20220728",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=4.2.0"
|
|
30
30
|
},
|
|
31
|
-
"packageManager": "npm@6.14.15",
|
|
32
31
|
"devDependencies": {
|
|
33
32
|
"@octokit/rest": "latest",
|
|
34
33
|
"@types/chai": "latest",
|
|
@@ -118,7 +117,9 @@
|
|
|
118
117
|
"source-map-support": false,
|
|
119
118
|
"inspector": false
|
|
120
119
|
},
|
|
120
|
+
"packageManager": "npm@8.15.0",
|
|
121
121
|
"volta": {
|
|
122
|
-
"node": "14.
|
|
122
|
+
"node": "14.20.0",
|
|
123
|
+
"npm": "8.15.0"
|
|
123
124
|
}
|
|
124
125
|
}
|