@typescript-deploys/pr-build 5.2.0-pr-54281-25 → 5.2.0-pr-53804-5
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/tsc.js +59 -35
- package/lib/tsserver.js +70 -46
- package/lib/tsserverlibrary.js +70 -46
- package/lib/typescript.js +70 -46
- package/lib/typingsInstaller.js +4 -2
- package/package.json +2 -2
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.2";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230613`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -42962,13 +42962,24 @@ function createTypeChecker(host) {
|
|
|
42962
42962
|
getTypeOfPropertyOfContextualType,
|
|
42963
42963
|
getFullyQualifiedName,
|
|
42964
42964
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
42965
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray
|
|
42966
|
-
|
|
42967
|
-
|
|
42968
|
-
|
|
42969
|
-
|
|
42970
|
-
|
|
42971
|
-
|
|
42965
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
|
|
42966
|
+
if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
42967
|
+
return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
42968
|
+
call,
|
|
42969
|
+
candidatesOutArray,
|
|
42970
|
+
/*argumentCount*/
|
|
42971
|
+
void 0,
|
|
42972
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
42973
|
+
));
|
|
42974
|
+
}
|
|
42975
|
+
return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
|
|
42976
|
+
call,
|
|
42977
|
+
candidatesOutArray,
|
|
42978
|
+
/*argumentCount*/
|
|
42979
|
+
void 0,
|
|
42980
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
42981
|
+
));
|
|
42982
|
+
},
|
|
42972
42983
|
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
42973
42984
|
getExpandedParameters,
|
|
42974
42985
|
hasEffectiveRestParameter,
|
|
@@ -50795,9 +50806,15 @@ function createTypeChecker(host) {
|
|
|
50795
50806
|
const prop = getPropertyOfType(type, name);
|
|
50796
50807
|
return prop ? getTypeOfSymbol(prop) : void 0;
|
|
50797
50808
|
}
|
|
50798
|
-
function getTypeOfPropertyOrIndexSignature(type, name) {
|
|
50809
|
+
function getTypeOfPropertyOrIndexSignature(type, name, addOptionalityToIndex) {
|
|
50799
50810
|
var _a;
|
|
50800
|
-
|
|
50811
|
+
let propType;
|
|
50812
|
+
return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality(
|
|
50813
|
+
propType,
|
|
50814
|
+
/*isProperty*/
|
|
50815
|
+
true,
|
|
50816
|
+
addOptionalityToIndex
|
|
50817
|
+
) || unknownType;
|
|
50801
50818
|
}
|
|
50802
50819
|
function isTypeAny(type) {
|
|
50803
50820
|
return type && (type.flags & 1 /* Any */) !== 0;
|
|
@@ -52681,19 +52698,13 @@ function createTypeChecker(host) {
|
|
|
52681
52698
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
52682
52699
|
const target = type.target;
|
|
52683
52700
|
const typeArguments = getTypeArguments(type);
|
|
52684
|
-
|
|
52685
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
52686
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
52687
|
-
}
|
|
52701
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
52688
52702
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
52689
52703
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
52690
52704
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
52691
52705
|
}
|
|
52692
52706
|
return needApparentType ? getApparentType(type) : type;
|
|
52693
52707
|
}
|
|
52694
|
-
function getThisArgument(type) {
|
|
52695
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
52696
|
-
}
|
|
52697
52708
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
52698
52709
|
let mapper;
|
|
52699
52710
|
let members;
|
|
@@ -53759,7 +53770,7 @@ function createTypeChecker(host) {
|
|
|
53759
53770
|
return type.resolvedBaseConstraint;
|
|
53760
53771
|
}
|
|
53761
53772
|
const stack = [];
|
|
53762
|
-
return type.resolvedBaseConstraint =
|
|
53773
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
53763
53774
|
function getImmediateBaseConstraint(t) {
|
|
53764
53775
|
if (!t.immediateBaseConstraint) {
|
|
53765
53776
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -53851,18 +53862,18 @@ function createTypeChecker(host) {
|
|
|
53851
53862
|
}
|
|
53852
53863
|
if (isGenericTupleType(t)) {
|
|
53853
53864
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
53854
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
53855
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
53865
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
53866
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
53856
53867
|
});
|
|
53857
53868
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
53858
53869
|
}
|
|
53859
53870
|
return t;
|
|
53860
53871
|
}
|
|
53861
53872
|
}
|
|
53862
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
53873
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
53863
53874
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
53864
53875
|
type,
|
|
53865
|
-
|
|
53876
|
+
thisArgument,
|
|
53866
53877
|
/*needApparentType*/
|
|
53867
53878
|
true
|
|
53868
53879
|
));
|
|
@@ -53913,8 +53924,9 @@ function createTypeChecker(host) {
|
|
|
53913
53924
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
53914
53925
|
}
|
|
53915
53926
|
function getApparentType(type) {
|
|
53916
|
-
const t =
|
|
53917
|
-
|
|
53927
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
53928
|
+
const objectFlags = getObjectFlags(t);
|
|
53929
|
+
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
53918
53930
|
}
|
|
53919
53931
|
function getReducedApparentType(type) {
|
|
53920
53932
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -60743,7 +60755,7 @@ function createTypeChecker(host) {
|
|
|
60743
60755
|
return 3 /* Maybe */;
|
|
60744
60756
|
}
|
|
60745
60757
|
const c = target2;
|
|
60746
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
60758
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
60747
60759
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
60748
60760
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
60749
60761
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -61804,7 +61816,12 @@ function createTypeChecker(host) {
|
|
|
61804
61816
|
let matched = false;
|
|
61805
61817
|
for (let i = 0; i < types.length; i++) {
|
|
61806
61818
|
if (include[i]) {
|
|
61807
|
-
const targetType =
|
|
61819
|
+
const targetType = getTypeOfPropertyOrIndexSignature(
|
|
61820
|
+
types[i],
|
|
61821
|
+
propertyName,
|
|
61822
|
+
/*addOptionalityToIndex*/
|
|
61823
|
+
true
|
|
61824
|
+
);
|
|
61808
61825
|
if (targetType && related(getDiscriminatingType(), targetType)) {
|
|
61809
61826
|
matched = true;
|
|
61810
61827
|
} else {
|
|
@@ -63735,7 +63752,7 @@ function createTypeChecker(host) {
|
|
|
63735
63752
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
63736
63753
|
if (constraint) {
|
|
63737
63754
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
63738
|
-
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
63755
|
+
if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
63739
63756
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
63740
63757
|
}
|
|
63741
63758
|
}
|
|
@@ -65202,7 +65219,12 @@ function createTypeChecker(host) {
|
|
|
65202
65219
|
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
65203
65220
|
const narrowedPropType = narrowType2(propType);
|
|
65204
65221
|
return filterType(type, (t) => {
|
|
65205
|
-
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
65222
|
+
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
65223
|
+
t,
|
|
65224
|
+
propName,
|
|
65225
|
+
/*addOptionalityToIndex*/
|
|
65226
|
+
false
|
|
65227
|
+
);
|
|
65206
65228
|
return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
|
|
65207
65229
|
});
|
|
65208
65230
|
}
|
|
@@ -65752,7 +65774,7 @@ function createTypeChecker(host) {
|
|
|
65752
65774
|
location = location.parent;
|
|
65753
65775
|
}
|
|
65754
65776
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
65755
|
-
const type = getTypeOfExpression(location);
|
|
65777
|
+
const type = removeOptionalTypeMarker(getTypeOfExpression(location));
|
|
65756
65778
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
65757
65779
|
return type;
|
|
65758
65780
|
}
|
|
@@ -69650,7 +69672,7 @@ function createTypeChecker(host) {
|
|
|
69650
69672
|
}
|
|
69651
69673
|
for (let i = 0; i < argCount; i++) {
|
|
69652
69674
|
const arg = args[i];
|
|
69653
|
-
if (arg.kind !== 231 /* OmittedExpression */
|
|
69675
|
+
if (arg.kind !== 231 /* OmittedExpression */) {
|
|
69654
69676
|
const paramType = getTypeAtPosition(signature, i);
|
|
69655
69677
|
if (couldContainTypeVariables(paramType)) {
|
|
69656
69678
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -70263,7 +70285,6 @@ function createTypeChecker(host) {
|
|
|
70263
70285
|
const args = getEffectiveCallArguments(node);
|
|
70264
70286
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70265
70287
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
70266
|
-
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
70267
70288
|
let candidatesForArgumentError;
|
|
70268
70289
|
let candidateForArgumentArityError;
|
|
70269
70290
|
let candidateForTypeArgumentError;
|
|
@@ -70487,7 +70508,7 @@ function createTypeChecker(host) {
|
|
|
70487
70508
|
continue;
|
|
70488
70509
|
}
|
|
70489
70510
|
if (argCheckMode) {
|
|
70490
|
-
argCheckMode =
|
|
70511
|
+
argCheckMode = 0 /* Normal */;
|
|
70491
70512
|
if (inferenceContext) {
|
|
70492
70513
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
70493
70514
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -73566,7 +73587,8 @@ function createTypeChecker(host) {
|
|
|
73566
73587
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
73567
73588
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
73568
73589
|
if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
|
|
73569
|
-
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right))
|
|
73590
|
+
if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
|
|
73591
|
+
(!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
|
|
73570
73592
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
73571
73593
|
error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
73572
73594
|
}
|
|
@@ -74339,7 +74361,7 @@ function createTypeChecker(host) {
|
|
|
74339
74361
|
return nullWideningType;
|
|
74340
74362
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
74341
74363
|
case 11 /* StringLiteral */:
|
|
74342
|
-
return hasSkipDirectInferenceFlag(node) ?
|
|
74364
|
+
return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
|
|
74343
74365
|
case 9 /* NumericLiteral */:
|
|
74344
74366
|
checkGrammarNumericLiteral(node);
|
|
74345
74367
|
return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
|
|
@@ -113768,7 +113790,9 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
113768
113790
|
Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
113769
113791
|
Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
113770
113792
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
113771
|
-
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
|
|
113793
|
+
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
113794
|
+
// Type errors
|
|
113795
|
+
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
113772
113796
|
]);
|
|
113773
113797
|
function shouldProgramCreateNewSourceFiles(program, newOptions) {
|
|
113774
113798
|
if (!program)
|
package/lib/tsserver.js
CHANGED
|
@@ -2305,7 +2305,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2305
2305
|
|
|
2306
2306
|
// src/compiler/corePublic.ts
|
|
2307
2307
|
var versionMajorMinor = "5.2";
|
|
2308
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2308
|
+
var version = `${versionMajorMinor}.0-insiders.20230613`;
|
|
2309
2309
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2310
2310
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2311
2311
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -47603,13 +47603,24 @@ function createTypeChecker(host) {
|
|
|
47603
47603
|
getTypeOfPropertyOfContextualType,
|
|
47604
47604
|
getFullyQualifiedName,
|
|
47605
47605
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
47606
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray
|
|
47607
|
-
|
|
47608
|
-
|
|
47609
|
-
|
|
47610
|
-
|
|
47611
|
-
|
|
47612
|
-
|
|
47606
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
|
|
47607
|
+
if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
47608
|
+
return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
47609
|
+
call,
|
|
47610
|
+
candidatesOutArray,
|
|
47611
|
+
/*argumentCount*/
|
|
47612
|
+
void 0,
|
|
47613
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
47614
|
+
));
|
|
47615
|
+
}
|
|
47616
|
+
return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
|
|
47617
|
+
call,
|
|
47618
|
+
candidatesOutArray,
|
|
47619
|
+
/*argumentCount*/
|
|
47620
|
+
void 0,
|
|
47621
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
47622
|
+
));
|
|
47623
|
+
},
|
|
47613
47624
|
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
47614
47625
|
getExpandedParameters,
|
|
47615
47626
|
hasEffectiveRestParameter,
|
|
@@ -55436,9 +55447,15 @@ function createTypeChecker(host) {
|
|
|
55436
55447
|
const prop = getPropertyOfType(type, name);
|
|
55437
55448
|
return prop ? getTypeOfSymbol(prop) : void 0;
|
|
55438
55449
|
}
|
|
55439
|
-
function getTypeOfPropertyOrIndexSignature(type, name) {
|
|
55450
|
+
function getTypeOfPropertyOrIndexSignature(type, name, addOptionalityToIndex) {
|
|
55440
55451
|
var _a;
|
|
55441
|
-
|
|
55452
|
+
let propType;
|
|
55453
|
+
return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality(
|
|
55454
|
+
propType,
|
|
55455
|
+
/*isProperty*/
|
|
55456
|
+
true,
|
|
55457
|
+
addOptionalityToIndex
|
|
55458
|
+
) || unknownType;
|
|
55442
55459
|
}
|
|
55443
55460
|
function isTypeAny(type) {
|
|
55444
55461
|
return type && (type.flags & 1 /* Any */) !== 0;
|
|
@@ -57322,19 +57339,13 @@ function createTypeChecker(host) {
|
|
|
57322
57339
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
57323
57340
|
const target = type.target;
|
|
57324
57341
|
const typeArguments = getTypeArguments(type);
|
|
57325
|
-
|
|
57326
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
57327
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
57328
|
-
}
|
|
57342
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
57329
57343
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
57330
57344
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
57331
57345
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
57332
57346
|
}
|
|
57333
57347
|
return needApparentType ? getApparentType(type) : type;
|
|
57334
57348
|
}
|
|
57335
|
-
function getThisArgument(type) {
|
|
57336
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
57337
|
-
}
|
|
57338
57349
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
57339
57350
|
let mapper;
|
|
57340
57351
|
let members;
|
|
@@ -58400,7 +58411,7 @@ function createTypeChecker(host) {
|
|
|
58400
58411
|
return type.resolvedBaseConstraint;
|
|
58401
58412
|
}
|
|
58402
58413
|
const stack = [];
|
|
58403
|
-
return type.resolvedBaseConstraint =
|
|
58414
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
58404
58415
|
function getImmediateBaseConstraint(t) {
|
|
58405
58416
|
if (!t.immediateBaseConstraint) {
|
|
58406
58417
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -58492,18 +58503,18 @@ function createTypeChecker(host) {
|
|
|
58492
58503
|
}
|
|
58493
58504
|
if (isGenericTupleType(t)) {
|
|
58494
58505
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
58495
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
58496
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
58506
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
58507
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
58497
58508
|
});
|
|
58498
58509
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
58499
58510
|
}
|
|
58500
58511
|
return t;
|
|
58501
58512
|
}
|
|
58502
58513
|
}
|
|
58503
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
58514
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
58504
58515
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
58505
58516
|
type,
|
|
58506
|
-
|
|
58517
|
+
thisArgument,
|
|
58507
58518
|
/*needApparentType*/
|
|
58508
58519
|
true
|
|
58509
58520
|
));
|
|
@@ -58554,8 +58565,9 @@ function createTypeChecker(host) {
|
|
|
58554
58565
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
58555
58566
|
}
|
|
58556
58567
|
function getApparentType(type) {
|
|
58557
|
-
const t =
|
|
58558
|
-
|
|
58568
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
58569
|
+
const objectFlags = getObjectFlags(t);
|
|
58570
|
+
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
58559
58571
|
}
|
|
58560
58572
|
function getReducedApparentType(type) {
|
|
58561
58573
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -65384,7 +65396,7 @@ function createTypeChecker(host) {
|
|
|
65384
65396
|
return 3 /* Maybe */;
|
|
65385
65397
|
}
|
|
65386
65398
|
const c = target2;
|
|
65387
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
65399
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
65388
65400
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
65389
65401
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
65390
65402
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -66445,7 +66457,12 @@ function createTypeChecker(host) {
|
|
|
66445
66457
|
let matched = false;
|
|
66446
66458
|
for (let i = 0; i < types.length; i++) {
|
|
66447
66459
|
if (include[i]) {
|
|
66448
|
-
const targetType =
|
|
66460
|
+
const targetType = getTypeOfPropertyOrIndexSignature(
|
|
66461
|
+
types[i],
|
|
66462
|
+
propertyName,
|
|
66463
|
+
/*addOptionalityToIndex*/
|
|
66464
|
+
true
|
|
66465
|
+
);
|
|
66449
66466
|
if (targetType && related(getDiscriminatingType(), targetType)) {
|
|
66450
66467
|
matched = true;
|
|
66451
66468
|
} else {
|
|
@@ -68376,7 +68393,7 @@ function createTypeChecker(host) {
|
|
|
68376
68393
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
68377
68394
|
if (constraint) {
|
|
68378
68395
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
68379
|
-
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
68396
|
+
if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
68380
68397
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
68381
68398
|
}
|
|
68382
68399
|
}
|
|
@@ -69843,7 +69860,12 @@ function createTypeChecker(host) {
|
|
|
69843
69860
|
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
69844
69861
|
const narrowedPropType = narrowType2(propType);
|
|
69845
69862
|
return filterType(type, (t) => {
|
|
69846
|
-
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
69863
|
+
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
69864
|
+
t,
|
|
69865
|
+
propName,
|
|
69866
|
+
/*addOptionalityToIndex*/
|
|
69867
|
+
false
|
|
69868
|
+
);
|
|
69847
69869
|
return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
|
|
69848
69870
|
});
|
|
69849
69871
|
}
|
|
@@ -70393,7 +70415,7 @@ function createTypeChecker(host) {
|
|
|
70393
70415
|
location = location.parent;
|
|
70394
70416
|
}
|
|
70395
70417
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
70396
|
-
const type = getTypeOfExpression(location);
|
|
70418
|
+
const type = removeOptionalTypeMarker(getTypeOfExpression(location));
|
|
70397
70419
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
70398
70420
|
return type;
|
|
70399
70421
|
}
|
|
@@ -74291,7 +74313,7 @@ function createTypeChecker(host) {
|
|
|
74291
74313
|
}
|
|
74292
74314
|
for (let i = 0; i < argCount; i++) {
|
|
74293
74315
|
const arg = args[i];
|
|
74294
|
-
if (arg.kind !== 231 /* OmittedExpression */
|
|
74316
|
+
if (arg.kind !== 231 /* OmittedExpression */) {
|
|
74295
74317
|
const paramType = getTypeAtPosition(signature, i);
|
|
74296
74318
|
if (couldContainTypeVariables(paramType)) {
|
|
74297
74319
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -74904,7 +74926,6 @@ function createTypeChecker(host) {
|
|
|
74904
74926
|
const args = getEffectiveCallArguments(node);
|
|
74905
74927
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
74906
74928
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
74907
|
-
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
74908
74929
|
let candidatesForArgumentError;
|
|
74909
74930
|
let candidateForArgumentArityError;
|
|
74910
74931
|
let candidateForTypeArgumentError;
|
|
@@ -75128,7 +75149,7 @@ function createTypeChecker(host) {
|
|
|
75128
75149
|
continue;
|
|
75129
75150
|
}
|
|
75130
75151
|
if (argCheckMode) {
|
|
75131
|
-
argCheckMode =
|
|
75152
|
+
argCheckMode = 0 /* Normal */;
|
|
75132
75153
|
if (inferenceContext) {
|
|
75133
75154
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75134
75155
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -78207,7 +78228,8 @@ function createTypeChecker(host) {
|
|
|
78207
78228
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
78208
78229
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
78209
78230
|
if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
|
|
78210
|
-
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right))
|
|
78231
|
+
if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
|
|
78232
|
+
(!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
|
|
78211
78233
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
78212
78234
|
error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
78213
78235
|
}
|
|
@@ -78980,7 +79002,7 @@ function createTypeChecker(host) {
|
|
|
78980
79002
|
return nullWideningType;
|
|
78981
79003
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
78982
79004
|
case 11 /* StringLiteral */:
|
|
78983
|
-
return hasSkipDirectInferenceFlag(node) ?
|
|
79005
|
+
return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
|
|
78984
79006
|
case 9 /* NumericLiteral */:
|
|
78985
79007
|
checkGrammarNumericLiteral(node);
|
|
78986
79008
|
return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
|
|
@@ -118645,7 +118667,9 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
118645
118667
|
Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
118646
118668
|
Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
118647
118669
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
118648
|
-
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
|
|
118670
|
+
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
118671
|
+
// Type errors
|
|
118672
|
+
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
118649
118673
|
]);
|
|
118650
118674
|
function shouldProgramCreateNewSourceFiles(program, newOptions) {
|
|
118651
118675
|
if (!program)
|
|
@@ -136459,21 +136483,21 @@ registerRefactor(refactorName4, {
|
|
|
136459
136483
|
if (!info) {
|
|
136460
136484
|
return emptyArray;
|
|
136461
136485
|
}
|
|
136462
|
-
if (ts_refactor_exports.isRefactorErrorInfo(info)
|
|
136486
|
+
if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
|
|
136463
136487
|
return [{
|
|
136464
136488
|
name: refactorName4,
|
|
136465
136489
|
description: refactorDescription,
|
|
136466
|
-
actions: [
|
|
136467
|
-
...inlineVariableAction,
|
|
136468
|
-
notApplicableReason: info.error
|
|
136469
|
-
}]
|
|
136490
|
+
actions: [inlineVariableAction]
|
|
136470
136491
|
}];
|
|
136471
136492
|
}
|
|
136472
|
-
if (
|
|
136493
|
+
if (preferences.provideRefactorNotApplicableReason) {
|
|
136473
136494
|
return [{
|
|
136474
136495
|
name: refactorName4,
|
|
136475
136496
|
description: refactorDescription,
|
|
136476
|
-
actions: [
|
|
136497
|
+
actions: [{
|
|
136498
|
+
...inlineVariableAction,
|
|
136499
|
+
notApplicableReason: info.error
|
|
136500
|
+
}]
|
|
136477
136501
|
}];
|
|
136478
136502
|
}
|
|
136479
136503
|
return emptyArray;
|
|
@@ -136504,7 +136528,7 @@ registerRefactor(refactorName4, {
|
|
|
136504
136528
|
function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
|
|
136505
136529
|
var _a, _b;
|
|
136506
136530
|
const checker = program.getTypeChecker();
|
|
136507
|
-
const token =
|
|
136531
|
+
const token = getTouchingPropertyName(file, startPosition);
|
|
136508
136532
|
const parent2 = token.parent;
|
|
136509
136533
|
if (!isIdentifier(token)) {
|
|
136510
136534
|
return void 0;
|
|
@@ -159118,7 +159142,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
|
|
|
159118
159142
|
case 290 /* JsxAttribute */:
|
|
159119
159143
|
if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
|
|
159120
159144
|
const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
|
|
159121
|
-
return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
|
|
159145
|
+
return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, 0 /* Normal */)) || fromContextualType(0 /* None */);
|
|
159122
159146
|
}
|
|
159123
159147
|
case 271 /* ImportDeclaration */:
|
|
159124
159148
|
case 277 /* ExportDeclaration */:
|
|
@@ -159187,12 +159211,12 @@ function walkUpParentheses(node) {
|
|
|
159187
159211
|
function getAlreadyUsedTypesInStringLiteralUnion(union, current) {
|
|
159188
159212
|
return mapDefined(union.types, (type) => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : void 0);
|
|
159189
159213
|
}
|
|
159190
|
-
function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) {
|
|
159214
|
+
function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
159191
159215
|
let isNewIdentifier = false;
|
|
159192
159216
|
const uniques = /* @__PURE__ */ new Map();
|
|
159193
159217
|
const candidates = [];
|
|
159194
159218
|
const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
|
|
159195
|
-
checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates);
|
|
159219
|
+
checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates, checkMode);
|
|
159196
159220
|
const types = flatMap(candidates, (candidate) => {
|
|
159197
159221
|
if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length)
|
|
159198
159222
|
return;
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230613`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -45392,13 +45392,24 @@ ${lanes.join("\n")}
|
|
|
45392
45392
|
getTypeOfPropertyOfContextualType,
|
|
45393
45393
|
getFullyQualifiedName,
|
|
45394
45394
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
45395
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray
|
|
45396
|
-
|
|
45397
|
-
|
|
45398
|
-
|
|
45399
|
-
|
|
45400
|
-
|
|
45401
|
-
|
|
45395
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
|
|
45396
|
+
if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
45397
|
+
return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
45398
|
+
call,
|
|
45399
|
+
candidatesOutArray,
|
|
45400
|
+
/*argumentCount*/
|
|
45401
|
+
void 0,
|
|
45402
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
45403
|
+
));
|
|
45404
|
+
}
|
|
45405
|
+
return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
|
|
45406
|
+
call,
|
|
45407
|
+
candidatesOutArray,
|
|
45408
|
+
/*argumentCount*/
|
|
45409
|
+
void 0,
|
|
45410
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
45411
|
+
));
|
|
45412
|
+
},
|
|
45402
45413
|
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
45403
45414
|
getExpandedParameters,
|
|
45404
45415
|
hasEffectiveRestParameter,
|
|
@@ -53225,9 +53236,15 @@ ${lanes.join("\n")}
|
|
|
53225
53236
|
const prop = getPropertyOfType(type, name);
|
|
53226
53237
|
return prop ? getTypeOfSymbol(prop) : void 0;
|
|
53227
53238
|
}
|
|
53228
|
-
function getTypeOfPropertyOrIndexSignature(type, name) {
|
|
53239
|
+
function getTypeOfPropertyOrIndexSignature(type, name, addOptionalityToIndex) {
|
|
53229
53240
|
var _a;
|
|
53230
|
-
|
|
53241
|
+
let propType;
|
|
53242
|
+
return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality(
|
|
53243
|
+
propType,
|
|
53244
|
+
/*isProperty*/
|
|
53245
|
+
true,
|
|
53246
|
+
addOptionalityToIndex
|
|
53247
|
+
) || unknownType;
|
|
53231
53248
|
}
|
|
53232
53249
|
function isTypeAny(type) {
|
|
53233
53250
|
return type && (type.flags & 1 /* Any */) !== 0;
|
|
@@ -55111,19 +55128,13 @@ ${lanes.join("\n")}
|
|
|
55111
55128
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
55112
55129
|
const target = type.target;
|
|
55113
55130
|
const typeArguments = getTypeArguments(type);
|
|
55114
|
-
|
|
55115
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
55116
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
55117
|
-
}
|
|
55131
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
55118
55132
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
55119
55133
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
55120
55134
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
55121
55135
|
}
|
|
55122
55136
|
return needApparentType ? getApparentType(type) : type;
|
|
55123
55137
|
}
|
|
55124
|
-
function getThisArgument(type) {
|
|
55125
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
55126
|
-
}
|
|
55127
55138
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
55128
55139
|
let mapper;
|
|
55129
55140
|
let members;
|
|
@@ -56189,7 +56200,7 @@ ${lanes.join("\n")}
|
|
|
56189
56200
|
return type.resolvedBaseConstraint;
|
|
56190
56201
|
}
|
|
56191
56202
|
const stack = [];
|
|
56192
|
-
return type.resolvedBaseConstraint =
|
|
56203
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
56193
56204
|
function getImmediateBaseConstraint(t) {
|
|
56194
56205
|
if (!t.immediateBaseConstraint) {
|
|
56195
56206
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -56281,18 +56292,18 @@ ${lanes.join("\n")}
|
|
|
56281
56292
|
}
|
|
56282
56293
|
if (isGenericTupleType(t)) {
|
|
56283
56294
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
56284
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
56285
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
56295
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
56296
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
56286
56297
|
});
|
|
56287
56298
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
56288
56299
|
}
|
|
56289
56300
|
return t;
|
|
56290
56301
|
}
|
|
56291
56302
|
}
|
|
56292
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
56303
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
56293
56304
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
56294
56305
|
type,
|
|
56295
|
-
|
|
56306
|
+
thisArgument,
|
|
56296
56307
|
/*needApparentType*/
|
|
56297
56308
|
true
|
|
56298
56309
|
));
|
|
@@ -56343,8 +56354,9 @@ ${lanes.join("\n")}
|
|
|
56343
56354
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
56344
56355
|
}
|
|
56345
56356
|
function getApparentType(type) {
|
|
56346
|
-
const t =
|
|
56347
|
-
|
|
56357
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
56358
|
+
const objectFlags = getObjectFlags(t);
|
|
56359
|
+
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
56348
56360
|
}
|
|
56349
56361
|
function getReducedApparentType(type) {
|
|
56350
56362
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -63173,7 +63185,7 @@ ${lanes.join("\n")}
|
|
|
63173
63185
|
return 3 /* Maybe */;
|
|
63174
63186
|
}
|
|
63175
63187
|
const c = target2;
|
|
63176
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
63188
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
63177
63189
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
63178
63190
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
63179
63191
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -64234,7 +64246,12 @@ ${lanes.join("\n")}
|
|
|
64234
64246
|
let matched = false;
|
|
64235
64247
|
for (let i = 0; i < types.length; i++) {
|
|
64236
64248
|
if (include[i]) {
|
|
64237
|
-
const targetType =
|
|
64249
|
+
const targetType = getTypeOfPropertyOrIndexSignature(
|
|
64250
|
+
types[i],
|
|
64251
|
+
propertyName,
|
|
64252
|
+
/*addOptionalityToIndex*/
|
|
64253
|
+
true
|
|
64254
|
+
);
|
|
64238
64255
|
if (targetType && related(getDiscriminatingType(), targetType)) {
|
|
64239
64256
|
matched = true;
|
|
64240
64257
|
} else {
|
|
@@ -66165,7 +66182,7 @@ ${lanes.join("\n")}
|
|
|
66165
66182
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
66166
66183
|
if (constraint) {
|
|
66167
66184
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
66168
|
-
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
66185
|
+
if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
66169
66186
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
66170
66187
|
}
|
|
66171
66188
|
}
|
|
@@ -67632,7 +67649,12 @@ ${lanes.join("\n")}
|
|
|
67632
67649
|
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
67633
67650
|
const narrowedPropType = narrowType2(propType);
|
|
67634
67651
|
return filterType(type, (t) => {
|
|
67635
|
-
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
67652
|
+
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
67653
|
+
t,
|
|
67654
|
+
propName,
|
|
67655
|
+
/*addOptionalityToIndex*/
|
|
67656
|
+
false
|
|
67657
|
+
);
|
|
67636
67658
|
return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
|
|
67637
67659
|
});
|
|
67638
67660
|
}
|
|
@@ -68182,7 +68204,7 @@ ${lanes.join("\n")}
|
|
|
68182
68204
|
location = location.parent;
|
|
68183
68205
|
}
|
|
68184
68206
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
68185
|
-
const type = getTypeOfExpression(location);
|
|
68207
|
+
const type = removeOptionalTypeMarker(getTypeOfExpression(location));
|
|
68186
68208
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
68187
68209
|
return type;
|
|
68188
68210
|
}
|
|
@@ -72080,7 +72102,7 @@ ${lanes.join("\n")}
|
|
|
72080
72102
|
}
|
|
72081
72103
|
for (let i = 0; i < argCount; i++) {
|
|
72082
72104
|
const arg = args[i];
|
|
72083
|
-
if (arg.kind !== 231 /* OmittedExpression */
|
|
72105
|
+
if (arg.kind !== 231 /* OmittedExpression */) {
|
|
72084
72106
|
const paramType = getTypeAtPosition(signature, i);
|
|
72085
72107
|
if (couldContainTypeVariables(paramType)) {
|
|
72086
72108
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -72693,7 +72715,6 @@ ${lanes.join("\n")}
|
|
|
72693
72715
|
const args = getEffectiveCallArguments(node);
|
|
72694
72716
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72695
72717
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72696
|
-
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
72697
72718
|
let candidatesForArgumentError;
|
|
72698
72719
|
let candidateForArgumentArityError;
|
|
72699
72720
|
let candidateForTypeArgumentError;
|
|
@@ -72917,7 +72938,7 @@ ${lanes.join("\n")}
|
|
|
72917
72938
|
continue;
|
|
72918
72939
|
}
|
|
72919
72940
|
if (argCheckMode) {
|
|
72920
|
-
argCheckMode =
|
|
72941
|
+
argCheckMode = 0 /* Normal */;
|
|
72921
72942
|
if (inferenceContext) {
|
|
72922
72943
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72923
72944
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -75996,7 +76017,8 @@ ${lanes.join("\n")}
|
|
|
75996
76017
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
75997
76018
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
75998
76019
|
if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
|
|
75999
|
-
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right))
|
|
76020
|
+
if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
|
|
76021
|
+
(!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
|
|
76000
76022
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
76001
76023
|
error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
76002
76024
|
}
|
|
@@ -76769,7 +76791,7 @@ ${lanes.join("\n")}
|
|
|
76769
76791
|
return nullWideningType;
|
|
76770
76792
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
76771
76793
|
case 11 /* StringLiteral */:
|
|
76772
|
-
return hasSkipDirectInferenceFlag(node) ?
|
|
76794
|
+
return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
|
|
76773
76795
|
case 9 /* NumericLiteral */:
|
|
76774
76796
|
checkGrammarNumericLiteral(node);
|
|
76775
76797
|
return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
|
|
@@ -120029,7 +120051,9 @@ ${lanes.join("\n")}
|
|
|
120029
120051
|
Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
120030
120052
|
Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
120031
120053
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
120032
|
-
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
|
|
120054
|
+
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
120055
|
+
// Type errors
|
|
120056
|
+
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
120033
120057
|
]);
|
|
120034
120058
|
emitSkippedWithNoDiagnostics = { diagnostics: emptyArray, sourceMaps: void 0, emittedFiles: void 0, emitSkipped: true };
|
|
120035
120059
|
}
|
|
@@ -134849,7 +134873,7 @@ ${lanes.join("\n")}
|
|
|
134849
134873
|
function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
|
|
134850
134874
|
var _a, _b;
|
|
134851
134875
|
const checker = program.getTypeChecker();
|
|
134852
|
-
const token =
|
|
134876
|
+
const token = getTouchingPropertyName(file, startPosition);
|
|
134853
134877
|
const parent2 = token.parent;
|
|
134854
134878
|
if (!isIdentifier(token)) {
|
|
134855
134879
|
return void 0;
|
|
@@ -134949,21 +134973,21 @@ ${lanes.join("\n")}
|
|
|
134949
134973
|
if (!info) {
|
|
134950
134974
|
return emptyArray;
|
|
134951
134975
|
}
|
|
134952
|
-
if (ts_refactor_exports.isRefactorErrorInfo(info)
|
|
134976
|
+
if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
|
|
134953
134977
|
return [{
|
|
134954
134978
|
name: refactorName4,
|
|
134955
134979
|
description: refactorDescription,
|
|
134956
|
-
actions: [
|
|
134957
|
-
...inlineVariableAction,
|
|
134958
|
-
notApplicableReason: info.error
|
|
134959
|
-
}]
|
|
134980
|
+
actions: [inlineVariableAction]
|
|
134960
134981
|
}];
|
|
134961
134982
|
}
|
|
134962
|
-
if (
|
|
134983
|
+
if (preferences.provideRefactorNotApplicableReason) {
|
|
134963
134984
|
return [{
|
|
134964
134985
|
name: refactorName4,
|
|
134965
134986
|
description: refactorDescription,
|
|
134966
|
-
actions: [
|
|
134987
|
+
actions: [{
|
|
134988
|
+
...inlineVariableAction,
|
|
134989
|
+
notApplicableReason: info.error
|
|
134990
|
+
}]
|
|
134967
134991
|
}];
|
|
134968
134992
|
}
|
|
134969
134993
|
return emptyArray;
|
|
@@ -158401,7 +158425,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158401
158425
|
case 290 /* JsxAttribute */:
|
|
158402
158426
|
if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
|
|
158403
158427
|
const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
|
|
158404
|
-
return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
|
|
158428
|
+
return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, 0 /* Normal */)) || fromContextualType(0 /* None */);
|
|
158405
158429
|
}
|
|
158406
158430
|
case 271 /* ImportDeclaration */:
|
|
158407
158431
|
case 277 /* ExportDeclaration */:
|
|
@@ -158470,12 +158494,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158470
158494
|
function getAlreadyUsedTypesInStringLiteralUnion(union, current) {
|
|
158471
158495
|
return mapDefined(union.types, (type) => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : void 0);
|
|
158472
158496
|
}
|
|
158473
|
-
function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) {
|
|
158497
|
+
function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
158474
158498
|
let isNewIdentifier = false;
|
|
158475
158499
|
const uniques = /* @__PURE__ */ new Map();
|
|
158476
158500
|
const candidates = [];
|
|
158477
158501
|
const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
|
|
158478
|
-
checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates);
|
|
158502
|
+
checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates, checkMode);
|
|
158479
158503
|
const types = flatMap(candidates, (candidate) => {
|
|
158480
158504
|
if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length)
|
|
158481
158505
|
return;
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230613`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -45392,13 +45392,24 @@ ${lanes.join("\n")}
|
|
|
45392
45392
|
getTypeOfPropertyOfContextualType,
|
|
45393
45393
|
getFullyQualifiedName,
|
|
45394
45394
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
45395
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray
|
|
45396
|
-
|
|
45397
|
-
|
|
45398
|
-
|
|
45399
|
-
|
|
45400
|
-
|
|
45401
|
-
|
|
45395
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => {
|
|
45396
|
+
if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
45397
|
+
return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
45398
|
+
call,
|
|
45399
|
+
candidatesOutArray,
|
|
45400
|
+
/*argumentCount*/
|
|
45401
|
+
void 0,
|
|
45402
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
45403
|
+
));
|
|
45404
|
+
}
|
|
45405
|
+
return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
|
|
45406
|
+
call,
|
|
45407
|
+
candidatesOutArray,
|
|
45408
|
+
/*argumentCount*/
|
|
45409
|
+
void 0,
|
|
45410
|
+
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
45411
|
+
));
|
|
45412
|
+
},
|
|
45402
45413
|
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
45403
45414
|
getExpandedParameters,
|
|
45404
45415
|
hasEffectiveRestParameter,
|
|
@@ -53225,9 +53236,15 @@ ${lanes.join("\n")}
|
|
|
53225
53236
|
const prop = getPropertyOfType(type, name);
|
|
53226
53237
|
return prop ? getTypeOfSymbol(prop) : void 0;
|
|
53227
53238
|
}
|
|
53228
|
-
function getTypeOfPropertyOrIndexSignature(type, name) {
|
|
53239
|
+
function getTypeOfPropertyOrIndexSignature(type, name, addOptionalityToIndex) {
|
|
53229
53240
|
var _a;
|
|
53230
|
-
|
|
53241
|
+
let propType;
|
|
53242
|
+
return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality(
|
|
53243
|
+
propType,
|
|
53244
|
+
/*isProperty*/
|
|
53245
|
+
true,
|
|
53246
|
+
addOptionalityToIndex
|
|
53247
|
+
) || unknownType;
|
|
53231
53248
|
}
|
|
53232
53249
|
function isTypeAny(type) {
|
|
53233
53250
|
return type && (type.flags & 1 /* Any */) !== 0;
|
|
@@ -55111,19 +55128,13 @@ ${lanes.join("\n")}
|
|
|
55111
55128
|
if (getObjectFlags(type) & 4 /* Reference */) {
|
|
55112
55129
|
const target = type.target;
|
|
55113
55130
|
const typeArguments = getTypeArguments(type);
|
|
55114
|
-
|
|
55115
|
-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
|
|
55116
|
-
return needApparentType ? getApparentType(ref) : ref;
|
|
55117
|
-
}
|
|
55131
|
+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
|
|
55118
55132
|
} else if (type.flags & 2097152 /* Intersection */) {
|
|
55119
55133
|
const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
|
|
55120
55134
|
return types !== type.types ? getIntersectionType(types) : type;
|
|
55121
55135
|
}
|
|
55122
55136
|
return needApparentType ? getApparentType(type) : type;
|
|
55123
55137
|
}
|
|
55124
|
-
function getThisArgument(type) {
|
|
55125
|
-
return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
|
|
55126
|
-
}
|
|
55127
55138
|
function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
|
|
55128
55139
|
let mapper;
|
|
55129
55140
|
let members;
|
|
@@ -56189,7 +56200,7 @@ ${lanes.join("\n")}
|
|
|
56189
56200
|
return type.resolvedBaseConstraint;
|
|
56190
56201
|
}
|
|
56191
56202
|
const stack = [];
|
|
56192
|
-
return type.resolvedBaseConstraint =
|
|
56203
|
+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
|
|
56193
56204
|
function getImmediateBaseConstraint(t) {
|
|
56194
56205
|
if (!t.immediateBaseConstraint) {
|
|
56195
56206
|
if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
|
|
@@ -56281,18 +56292,18 @@ ${lanes.join("\n")}
|
|
|
56281
56292
|
}
|
|
56282
56293
|
if (isGenericTupleType(t)) {
|
|
56283
56294
|
const newElements = map(getElementTypes(t), (v, i) => {
|
|
56284
|
-
const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
56285
|
-
return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
56295
|
+
const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
|
|
56296
|
+
return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
|
|
56286
56297
|
});
|
|
56287
56298
|
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
|
|
56288
56299
|
}
|
|
56289
56300
|
return t;
|
|
56290
56301
|
}
|
|
56291
56302
|
}
|
|
56292
|
-
function getApparentTypeOfIntersectionType(type) {
|
|
56303
|
+
function getApparentTypeOfIntersectionType(type, thisArgument) {
|
|
56293
56304
|
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
|
|
56294
56305
|
type,
|
|
56295
|
-
|
|
56306
|
+
thisArgument,
|
|
56296
56307
|
/*needApparentType*/
|
|
56297
56308
|
true
|
|
56298
56309
|
));
|
|
@@ -56343,8 +56354,9 @@ ${lanes.join("\n")}
|
|
|
56343
56354
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
56344
56355
|
}
|
|
56345
56356
|
function getApparentType(type) {
|
|
56346
|
-
const t =
|
|
56347
|
-
|
|
56357
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
56358
|
+
const objectFlags = getObjectFlags(t);
|
|
56359
|
+
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
56348
56360
|
}
|
|
56349
56361
|
function getReducedApparentType(type) {
|
|
56350
56362
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
@@ -63173,7 +63185,7 @@ ${lanes.join("\n")}
|
|
|
63173
63185
|
return 3 /* Maybe */;
|
|
63174
63186
|
}
|
|
63175
63187
|
const c = target2;
|
|
63176
|
-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
63188
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
|
|
63177
63189
|
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
63178
63190
|
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
63179
63191
|
if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
|
|
@@ -64234,7 +64246,12 @@ ${lanes.join("\n")}
|
|
|
64234
64246
|
let matched = false;
|
|
64235
64247
|
for (let i = 0; i < types.length; i++) {
|
|
64236
64248
|
if (include[i]) {
|
|
64237
|
-
const targetType =
|
|
64249
|
+
const targetType = getTypeOfPropertyOrIndexSignature(
|
|
64250
|
+
types[i],
|
|
64251
|
+
propertyName,
|
|
64252
|
+
/*addOptionalityToIndex*/
|
|
64253
|
+
true
|
|
64254
|
+
);
|
|
64238
64255
|
if (targetType && related(getDiscriminatingType(), targetType)) {
|
|
64239
64256
|
matched = true;
|
|
64240
64257
|
} else {
|
|
@@ -66165,7 +66182,7 @@ ${lanes.join("\n")}
|
|
|
66165
66182
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
66166
66183
|
if (constraint) {
|
|
66167
66184
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
66168
|
-
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
66185
|
+
if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
66169
66186
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
66170
66187
|
}
|
|
66171
66188
|
}
|
|
@@ -67632,7 +67649,12 @@ ${lanes.join("\n")}
|
|
|
67632
67649
|
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
67633
67650
|
const narrowedPropType = narrowType2(propType);
|
|
67634
67651
|
return filterType(type, (t) => {
|
|
67635
|
-
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
67652
|
+
const discriminantType = getTypeOfPropertyOrIndexSignature(
|
|
67653
|
+
t,
|
|
67654
|
+
propName,
|
|
67655
|
+
/*addOptionalityToIndex*/
|
|
67656
|
+
false
|
|
67657
|
+
);
|
|
67636
67658
|
return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
|
|
67637
67659
|
});
|
|
67638
67660
|
}
|
|
@@ -68182,7 +68204,7 @@ ${lanes.join("\n")}
|
|
|
68182
68204
|
location = location.parent;
|
|
68183
68205
|
}
|
|
68184
68206
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
68185
|
-
const type = getTypeOfExpression(location);
|
|
68207
|
+
const type = removeOptionalTypeMarker(getTypeOfExpression(location));
|
|
68186
68208
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
68187
68209
|
return type;
|
|
68188
68210
|
}
|
|
@@ -72080,7 +72102,7 @@ ${lanes.join("\n")}
|
|
|
72080
72102
|
}
|
|
72081
72103
|
for (let i = 0; i < argCount; i++) {
|
|
72082
72104
|
const arg = args[i];
|
|
72083
|
-
if (arg.kind !== 231 /* OmittedExpression */
|
|
72105
|
+
if (arg.kind !== 231 /* OmittedExpression */) {
|
|
72084
72106
|
const paramType = getTypeAtPosition(signature, i);
|
|
72085
72107
|
if (couldContainTypeVariables(paramType)) {
|
|
72086
72108
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -72693,7 +72715,6 @@ ${lanes.join("\n")}
|
|
|
72693
72715
|
const args = getEffectiveCallArguments(node);
|
|
72694
72716
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72695
72717
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72696
|
-
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
72697
72718
|
let candidatesForArgumentError;
|
|
72698
72719
|
let candidateForArgumentArityError;
|
|
72699
72720
|
let candidateForTypeArgumentError;
|
|
@@ -72917,7 +72938,7 @@ ${lanes.join("\n")}
|
|
|
72917
72938
|
continue;
|
|
72918
72939
|
}
|
|
72919
72940
|
if (argCheckMode) {
|
|
72920
|
-
argCheckMode =
|
|
72941
|
+
argCheckMode = 0 /* Normal */;
|
|
72921
72942
|
if (inferenceContext) {
|
|
72922
72943
|
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72923
72944
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
@@ -75996,7 +76017,8 @@ ${lanes.join("\n")}
|
|
|
75996
76017
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
75997
76018
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
75998
76019
|
if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
|
|
75999
|
-
if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right))
|
|
76020
|
+
if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
|
|
76021
|
+
(!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
|
|
76000
76022
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
76001
76023
|
error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
76002
76024
|
}
|
|
@@ -76769,7 +76791,7 @@ ${lanes.join("\n")}
|
|
|
76769
76791
|
return nullWideningType;
|
|
76770
76792
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
76771
76793
|
case 11 /* StringLiteral */:
|
|
76772
|
-
return hasSkipDirectInferenceFlag(node) ?
|
|
76794
|
+
return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
|
|
76773
76795
|
case 9 /* NumericLiteral */:
|
|
76774
76796
|
checkGrammarNumericLiteral(node);
|
|
76775
76797
|
return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
|
|
@@ -120029,7 +120051,9 @@ ${lanes.join("\n")}
|
|
|
120029
120051
|
Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
120030
120052
|
Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
120031
120053
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
120032
|
-
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
|
|
120054
|
+
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
120055
|
+
// Type errors
|
|
120056
|
+
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
120033
120057
|
]);
|
|
120034
120058
|
emitSkippedWithNoDiagnostics = { diagnostics: emptyArray, sourceMaps: void 0, emittedFiles: void 0, emitSkipped: true };
|
|
120035
120059
|
}
|
|
@@ -134864,7 +134888,7 @@ ${lanes.join("\n")}
|
|
|
134864
134888
|
function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
|
|
134865
134889
|
var _a, _b;
|
|
134866
134890
|
const checker = program.getTypeChecker();
|
|
134867
|
-
const token =
|
|
134891
|
+
const token = getTouchingPropertyName(file, startPosition);
|
|
134868
134892
|
const parent2 = token.parent;
|
|
134869
134893
|
if (!isIdentifier(token)) {
|
|
134870
134894
|
return void 0;
|
|
@@ -134964,21 +134988,21 @@ ${lanes.join("\n")}
|
|
|
134964
134988
|
if (!info) {
|
|
134965
134989
|
return emptyArray;
|
|
134966
134990
|
}
|
|
134967
|
-
if (ts_refactor_exports.isRefactorErrorInfo(info)
|
|
134991
|
+
if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
|
|
134968
134992
|
return [{
|
|
134969
134993
|
name: refactorName4,
|
|
134970
134994
|
description: refactorDescription,
|
|
134971
|
-
actions: [
|
|
134972
|
-
...inlineVariableAction,
|
|
134973
|
-
notApplicableReason: info.error
|
|
134974
|
-
}]
|
|
134995
|
+
actions: [inlineVariableAction]
|
|
134975
134996
|
}];
|
|
134976
134997
|
}
|
|
134977
|
-
if (
|
|
134998
|
+
if (preferences.provideRefactorNotApplicableReason) {
|
|
134978
134999
|
return [{
|
|
134979
135000
|
name: refactorName4,
|
|
134980
135001
|
description: refactorDescription,
|
|
134981
|
-
actions: [
|
|
135002
|
+
actions: [{
|
|
135003
|
+
...inlineVariableAction,
|
|
135004
|
+
notApplicableReason: info.error
|
|
135005
|
+
}]
|
|
134982
135006
|
}];
|
|
134983
135007
|
}
|
|
134984
135008
|
return emptyArray;
|
|
@@ -158416,7 +158440,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158416
158440
|
case 290 /* JsxAttribute */:
|
|
158417
158441
|
if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
|
|
158418
158442
|
const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
|
|
158419
|
-
return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
|
|
158443
|
+
return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, 0 /* Normal */)) || fromContextualType(0 /* None */);
|
|
158420
158444
|
}
|
|
158421
158445
|
case 271 /* ImportDeclaration */:
|
|
158422
158446
|
case 277 /* ExportDeclaration */:
|
|
@@ -158485,12 +158509,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158485
158509
|
function getAlreadyUsedTypesInStringLiteralUnion(union, current) {
|
|
158486
158510
|
return mapDefined(union.types, (type) => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : void 0);
|
|
158487
158511
|
}
|
|
158488
|
-
function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) {
|
|
158512
|
+
function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
158489
158513
|
let isNewIdentifier = false;
|
|
158490
158514
|
const uniques = /* @__PURE__ */ new Map();
|
|
158491
158515
|
const candidates = [];
|
|
158492
158516
|
const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
|
|
158493
|
-
checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates);
|
|
158517
|
+
checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates, checkMode);
|
|
158494
158518
|
const types = flatMap(candidates, (candidate) => {
|
|
158495
158519
|
if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length)
|
|
158496
158520
|
return;
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.2";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230613`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -30680,7 +30680,9 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
30680
30680
|
Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
30681
30681
|
Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
30682
30682
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
30683
|
-
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
|
|
30683
|
+
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
30684
|
+
// Type errors
|
|
30685
|
+
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
30684
30686
|
]);
|
|
30685
30687
|
|
|
30686
30688
|
// src/compiler/builderState.ts
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.2.0-pr-
|
|
5
|
+
"version": "5.2.0-pr-53804-5",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"node": "20.1.0",
|
|
116
116
|
"npm": "8.19.4"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "ce97e292eee1cc68a0a3c9c92472259247e48a1f"
|
|
119
119
|
}
|