@typescript-deploys/pr-build 5.2.0-pr-54935-17 → 5.2.0-pr-55028-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 +41 -74
- package/lib/tsserver.js +46 -75
- package/lib/tsserverlibrary.js +46 -75
- package/lib/typescript.js +46 -75
- package/lib/typingsInstaller.js +3 -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.20230720`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3762,7 +3762,8 @@ var SignatureFlags = /* @__PURE__ */ ((SignatureFlags4) => {
|
|
|
3762
3762
|
SignatureFlags4[SignatureFlags4["IsOuterCallChain"] = 16] = "IsOuterCallChain";
|
|
3763
3763
|
SignatureFlags4[SignatureFlags4["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
|
|
3764
3764
|
SignatureFlags4[SignatureFlags4["IsNonInferrable"] = 64] = "IsNonInferrable";
|
|
3765
|
-
SignatureFlags4[SignatureFlags4["
|
|
3765
|
+
SignatureFlags4[SignatureFlags4["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
|
|
3766
|
+
SignatureFlags4[SignatureFlags4["PropagatingFlags"] = 167] = "PropagatingFlags";
|
|
3766
3767
|
SignatureFlags4[SignatureFlags4["CallChainFlags"] = 24] = "CallChainFlags";
|
|
3767
3768
|
return SignatureFlags4;
|
|
3768
3769
|
})(SignatureFlags || {});
|
|
@@ -44374,7 +44375,7 @@ function createTypeChecker(host) {
|
|
|
44374
44375
|
false
|
|
44375
44376
|
);
|
|
44376
44377
|
} else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
44377
|
-
return !(
|
|
44378
|
+
return !(useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration));
|
|
44378
44379
|
}
|
|
44379
44380
|
return true;
|
|
44380
44381
|
}
|
|
@@ -44388,7 +44389,7 @@ function createTypeChecker(host) {
|
|
|
44388
44389
|
return true;
|
|
44389
44390
|
}
|
|
44390
44391
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
44391
|
-
if (
|
|
44392
|
+
if (useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
44392
44393
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
44393
44394
|
declaration,
|
|
44394
44395
|
usage,
|
|
@@ -44512,7 +44513,7 @@ function createTypeChecker(host) {
|
|
|
44512
44513
|
return requiresScopeChangeWorker(node.name);
|
|
44513
44514
|
case 172 /* PropertyDeclaration */:
|
|
44514
44515
|
if (hasStaticModifier(node)) {
|
|
44515
|
-
return
|
|
44516
|
+
return !useDefineForClassFields;
|
|
44516
44517
|
}
|
|
44517
44518
|
return requiresScopeChangeWorker(node.name);
|
|
44518
44519
|
default:
|
|
@@ -44551,7 +44552,7 @@ function createTypeChecker(host) {
|
|
|
44551
44552
|
if (name === "const" && isConstAssertion(location)) {
|
|
44552
44553
|
return void 0;
|
|
44553
44554
|
}
|
|
44554
|
-
if (
|
|
44555
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
44555
44556
|
lastLocation = location;
|
|
44556
44557
|
location = location.parent;
|
|
44557
44558
|
}
|
|
@@ -44783,7 +44784,7 @@ function createTypeChecker(host) {
|
|
|
44783
44784
|
}
|
|
44784
44785
|
}
|
|
44785
44786
|
function checkAndReportErrorForInvalidInitializer() {
|
|
44786
|
-
if (propertyWithInvalidInitializer && !
|
|
44787
|
+
if (propertyWithInvalidInitializer && !useDefineForClassFields) {
|
|
44787
44788
|
error(
|
|
44788
44789
|
errorLocation,
|
|
44789
44790
|
errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
|
|
@@ -48184,7 +48185,7 @@ function createTypeChecker(host) {
|
|
|
48184
48185
|
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
|
|
48185
48186
|
}
|
|
48186
48187
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
48187
|
-
var _a
|
|
48188
|
+
var _a;
|
|
48188
48189
|
const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
|
|
48189
48190
|
const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
48190
48191
|
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
@@ -48234,57 +48235,17 @@ function createTypeChecker(host) {
|
|
|
48234
48235
|
context.reverseMappedStack.pop();
|
|
48235
48236
|
}
|
|
48236
48237
|
}
|
|
48237
|
-
|
|
48238
|
-
|
|
48239
|
-
|
|
48240
|
-
const getAccessorSignature = factory.createGetAccessorDeclaration(
|
|
48241
|
-
/*modifiers*/
|
|
48242
|
-
void 0,
|
|
48243
|
-
propertyName,
|
|
48244
|
-
[],
|
|
48245
|
-
propertyTypeNode,
|
|
48246
|
-
/*body*/
|
|
48247
|
-
void 0
|
|
48248
|
-
);
|
|
48249
|
-
setCommentRange(getAccessorSignature, getAccessorDecl);
|
|
48250
|
-
typeElements.push(getAccessorSignature);
|
|
48251
|
-
}
|
|
48252
|
-
if (propertySymbol.flags & 65536 /* SetAccessor */) {
|
|
48253
|
-
const setAccessorDecl = find(propertySymbol.declarations, (decl) => decl.kind === 178 /* SetAccessor */);
|
|
48254
|
-
const parameterName = ((_b = setAccessorDecl == null ? void 0 : setAccessorDecl.parameters) == null ? void 0 : _b.length) > 0 ? setAccessorDecl.parameters[0].name : "arg";
|
|
48255
|
-
const setAccessorSignature = factory.createSetAccessorDeclaration(
|
|
48256
|
-
/*modifiers*/
|
|
48257
|
-
void 0,
|
|
48258
|
-
propertyName,
|
|
48259
|
-
[factory.createParameterDeclaration(
|
|
48260
|
-
/*modifiers*/
|
|
48261
|
-
void 0,
|
|
48262
|
-
/*dotDotDotToken*/
|
|
48263
|
-
void 0,
|
|
48264
|
-
parameterName,
|
|
48265
|
-
/*questionToken*/
|
|
48266
|
-
void 0,
|
|
48267
|
-
propertyTypeNode
|
|
48268
|
-
)],
|
|
48269
|
-
/*body*/
|
|
48270
|
-
void 0
|
|
48271
|
-
);
|
|
48272
|
-
setCommentRange(setAccessorSignature, setAccessorDecl);
|
|
48273
|
-
typeElements.push(setAccessorSignature);
|
|
48274
|
-
}
|
|
48275
|
-
} else {
|
|
48276
|
-
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
48277
|
-
if (modifiers) {
|
|
48278
|
-
context.approximateLength += 9;
|
|
48279
|
-
}
|
|
48280
|
-
const propertySignature = factory.createPropertySignature(
|
|
48281
|
-
modifiers,
|
|
48282
|
-
propertyName,
|
|
48283
|
-
optionalToken,
|
|
48284
|
-
propertyTypeNode
|
|
48285
|
-
);
|
|
48286
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
48238
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
48239
|
+
if (modifiers) {
|
|
48240
|
+
context.approximateLength += 9;
|
|
48287
48241
|
}
|
|
48242
|
+
const propertySignature = factory.createPropertySignature(
|
|
48243
|
+
modifiers,
|
|
48244
|
+
propertyName,
|
|
48245
|
+
optionalToken,
|
|
48246
|
+
propertyTypeNode
|
|
48247
|
+
);
|
|
48248
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
48288
48249
|
function preserveCommentsOn(node) {
|
|
48289
48250
|
var _a2;
|
|
48290
48251
|
if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
|
|
@@ -51613,7 +51574,7 @@ function createTypeChecker(host) {
|
|
|
51613
51574
|
false,
|
|
51614
51575
|
definedInMethod && !definedInConstructor
|
|
51615
51576
|
));
|
|
51616
|
-
if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
51577
|
+
if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
51617
51578
|
reportImplicitAny(symbol.valueDeclaration, anyType);
|
|
51618
51579
|
return anyType;
|
|
51619
51580
|
}
|
|
@@ -52973,6 +52934,7 @@ function createTypeChecker(host) {
|
|
|
52973
52934
|
return links.resolvedSymbol;
|
|
52974
52935
|
}
|
|
52975
52936
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
52937
|
+
var _a, _b, _c;
|
|
52976
52938
|
const links = getSymbolLinks(symbol);
|
|
52977
52939
|
if (!links[resolutionKind]) {
|
|
52978
52940
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -52991,7 +52953,7 @@ function createTypeChecker(host) {
|
|
|
52991
52953
|
}
|
|
52992
52954
|
}
|
|
52993
52955
|
}
|
|
52994
|
-
const assignments = symbol.assignmentDeclarationMembers;
|
|
52956
|
+
const assignments = (((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */) && ((_c = getSymbolOfNode(symbol.valueDeclaration.parent)) == null ? void 0 : _c.assignmentDeclarationMembers) || symbol.assignmentDeclarationMembers;
|
|
52995
52957
|
if (assignments) {
|
|
52996
52958
|
const decls = arrayFrom(assignments.values());
|
|
52997
52959
|
for (const member of decls) {
|
|
@@ -53120,7 +53082,7 @@ function createTypeChecker(host) {
|
|
|
53120
53082
|
/*resolvedTypePredicate*/
|
|
53121
53083
|
void 0,
|
|
53122
53084
|
sig.minArgumentCount,
|
|
53123
|
-
sig.flags &
|
|
53085
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
53124
53086
|
);
|
|
53125
53087
|
result.target = sig.target;
|
|
53126
53088
|
result.mapper = sig.mapper;
|
|
@@ -53421,7 +53383,7 @@ function createTypeChecker(host) {
|
|
|
53421
53383
|
/*resolvedTypePredicate*/
|
|
53422
53384
|
void 0,
|
|
53423
53385
|
minArgCount,
|
|
53424
|
-
(left.flags | right.flags) &
|
|
53386
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
53425
53387
|
);
|
|
53426
53388
|
result.compositeKind = 1048576 /* Union */;
|
|
53427
53389
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -53631,7 +53593,7 @@ function createTypeChecker(host) {
|
|
|
53631
53593
|
/*resolvedTypePredicate*/
|
|
53632
53594
|
void 0,
|
|
53633
53595
|
sig.minArgumentCount,
|
|
53634
|
-
sig.flags &
|
|
53596
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
53635
53597
|
) : void 0
|
|
53636
53598
|
));
|
|
53637
53599
|
}
|
|
@@ -58414,7 +58376,7 @@ function createTypeChecker(host) {
|
|
|
58414
58376
|
/*resolvedTypePredicate*/
|
|
58415
58377
|
void 0,
|
|
58416
58378
|
signature.minArgumentCount,
|
|
58417
|
-
signature.flags &
|
|
58379
|
+
signature.flags & 167 /* PropagatingFlags */
|
|
58418
58380
|
);
|
|
58419
58381
|
result.target = signature;
|
|
58420
58382
|
result.mapper = mapper;
|
|
@@ -65675,12 +65637,15 @@ function createTypeChecker(host) {
|
|
|
65675
65637
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
65676
65638
|
}
|
|
65677
65639
|
const target = getReferenceCandidate(expr.right);
|
|
65678
|
-
|
|
65679
|
-
|
|
65680
|
-
if (
|
|
65640
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
|
|
65641
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
65642
|
+
if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
65681
65643
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
65682
65644
|
}
|
|
65683
|
-
|
|
65645
|
+
}
|
|
65646
|
+
if (isMatchingReference(reference, target)) {
|
|
65647
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
65648
|
+
if (isTypeUsableAsPropertyName(leftType)) {
|
|
65684
65649
|
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
65685
65650
|
}
|
|
65686
65651
|
}
|
|
@@ -67863,7 +67828,7 @@ function createTypeChecker(host) {
|
|
|
67863
67828
|
/*resolvedTypePredicate*/
|
|
67864
67829
|
void 0,
|
|
67865
67830
|
minArgCount,
|
|
67866
|
-
(left.flags | right.flags) &
|
|
67831
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
67867
67832
|
);
|
|
67868
67833
|
result.compositeKind = 2097152 /* Intersection */;
|
|
67869
67834
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -69397,7 +69362,7 @@ function createTypeChecker(host) {
|
|
|
69397
69362
|
}
|
|
69398
69363
|
let diagnosticMessage;
|
|
69399
69364
|
const declarationName = idText(right);
|
|
69400
|
-
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (
|
|
69365
|
+
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
69401
69366
|
diagnosticMessage = error(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
69402
69367
|
} else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
69403
69368
|
diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
@@ -70892,7 +70857,7 @@ function createTypeChecker(host) {
|
|
|
70892
70857
|
parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i))));
|
|
70893
70858
|
}
|
|
70894
70859
|
const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0);
|
|
70895
|
-
let flags =
|
|
70860
|
+
let flags = 128 /* IsSignatureCandidateForOverloadFailure */;
|
|
70896
70861
|
if (restParameterSymbols.length !== 0) {
|
|
70897
70862
|
const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */));
|
|
70898
70863
|
parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
|
|
@@ -71616,6 +71581,8 @@ function createTypeChecker(host) {
|
|
|
71616
71581
|
return returnType;
|
|
71617
71582
|
}
|
|
71618
71583
|
function checkDeprecatedSignature(signature, node) {
|
|
71584
|
+
if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */)
|
|
71585
|
+
return;
|
|
71619
71586
|
if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) {
|
|
71620
71587
|
const suggestionNode = getDeprecatedSuggestionNode(node);
|
|
71621
71588
|
const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node));
|
|
@@ -75089,7 +75056,7 @@ function createTypeChecker(host) {
|
|
|
75089
75056
|
case "length":
|
|
75090
75057
|
case "caller":
|
|
75091
75058
|
case "arguments":
|
|
75092
|
-
if (
|
|
75059
|
+
if (useDefineForClassFields) {
|
|
75093
75060
|
break;
|
|
75094
75061
|
}
|
|
75095
75062
|
case "prototype":
|
|
@@ -75237,7 +75204,7 @@ function createTypeChecker(host) {
|
|
|
75237
75204
|
if (classExtendsNull) {
|
|
75238
75205
|
error(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
75239
75206
|
}
|
|
75240
|
-
const superCallShouldBeRootLevel =
|
|
75207
|
+
const superCallShouldBeRootLevel = !useDefineForClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
75241
75208
|
if (superCallShouldBeRootLevel) {
|
|
75242
75209
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
75243
75210
|
error(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
@@ -78507,7 +78474,7 @@ function createTypeChecker(host) {
|
|
|
78507
78474
|
node
|
|
78508
78475
|
);
|
|
78509
78476
|
const willTransformPrivateElementsOrClassStaticBlocks = languageVersion <= 9 /* ES2022 */;
|
|
78510
|
-
const willTransformInitializers = !useDefineForClassFields
|
|
78477
|
+
const willTransformInitializers = !useDefineForClassFields;
|
|
78511
78478
|
if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
|
|
78512
78479
|
for (const member of node.members) {
|
|
78513
78480
|
if (willTransformStaticElementsOfDecoratedClass && classElementOrClassElementParameterIsDecorated(
|
package/lib/tsserver.js
CHANGED
|
@@ -2327,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2327
2327
|
|
|
2328
2328
|
// src/compiler/corePublic.ts
|
|
2329
2329
|
var versionMajorMinor = "5.2";
|
|
2330
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2330
|
+
var version = `${versionMajorMinor}.0-insiders.20230720`;
|
|
2331
2331
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2332
2332
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2333
2333
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6810,7 +6810,8 @@ var SignatureFlags = /* @__PURE__ */ ((SignatureFlags5) => {
|
|
|
6810
6810
|
SignatureFlags5[SignatureFlags5["IsOuterCallChain"] = 16] = "IsOuterCallChain";
|
|
6811
6811
|
SignatureFlags5[SignatureFlags5["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
|
|
6812
6812
|
SignatureFlags5[SignatureFlags5["IsNonInferrable"] = 64] = "IsNonInferrable";
|
|
6813
|
-
SignatureFlags5[SignatureFlags5["
|
|
6813
|
+
SignatureFlags5[SignatureFlags5["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
|
|
6814
|
+
SignatureFlags5[SignatureFlags5["PropagatingFlags"] = 167] = "PropagatingFlags";
|
|
6814
6815
|
SignatureFlags5[SignatureFlags5["CallChainFlags"] = 24] = "CallChainFlags";
|
|
6815
6816
|
return SignatureFlags5;
|
|
6816
6817
|
})(SignatureFlags || {});
|
|
@@ -49081,7 +49082,7 @@ function createTypeChecker(host) {
|
|
|
49081
49082
|
false
|
|
49082
49083
|
);
|
|
49083
49084
|
} else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
49084
|
-
return !(
|
|
49085
|
+
return !(useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration));
|
|
49085
49086
|
}
|
|
49086
49087
|
return true;
|
|
49087
49088
|
}
|
|
@@ -49095,7 +49096,7 @@ function createTypeChecker(host) {
|
|
|
49095
49096
|
return true;
|
|
49096
49097
|
}
|
|
49097
49098
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
49098
|
-
if (
|
|
49099
|
+
if (useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
49099
49100
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
49100
49101
|
declaration,
|
|
49101
49102
|
usage,
|
|
@@ -49219,7 +49220,7 @@ function createTypeChecker(host) {
|
|
|
49219
49220
|
return requiresScopeChangeWorker(node.name);
|
|
49220
49221
|
case 172 /* PropertyDeclaration */:
|
|
49221
49222
|
if (hasStaticModifier(node)) {
|
|
49222
|
-
return
|
|
49223
|
+
return !useDefineForClassFields;
|
|
49223
49224
|
}
|
|
49224
49225
|
return requiresScopeChangeWorker(node.name);
|
|
49225
49226
|
default:
|
|
@@ -49258,7 +49259,7 @@ function createTypeChecker(host) {
|
|
|
49258
49259
|
if (name === "const" && isConstAssertion(location)) {
|
|
49259
49260
|
return void 0;
|
|
49260
49261
|
}
|
|
49261
|
-
if (
|
|
49262
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
49262
49263
|
lastLocation = location;
|
|
49263
49264
|
location = location.parent;
|
|
49264
49265
|
}
|
|
@@ -49490,7 +49491,7 @@ function createTypeChecker(host) {
|
|
|
49490
49491
|
}
|
|
49491
49492
|
}
|
|
49492
49493
|
function checkAndReportErrorForInvalidInitializer() {
|
|
49493
|
-
if (propertyWithInvalidInitializer && !
|
|
49494
|
+
if (propertyWithInvalidInitializer && !useDefineForClassFields) {
|
|
49494
49495
|
error2(
|
|
49495
49496
|
errorLocation,
|
|
49496
49497
|
errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
|
|
@@ -52891,7 +52892,7 @@ function createTypeChecker(host) {
|
|
|
52891
52892
|
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
|
|
52892
52893
|
}
|
|
52893
52894
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
52894
|
-
var _a
|
|
52895
|
+
var _a;
|
|
52895
52896
|
const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
|
|
52896
52897
|
const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
52897
52898
|
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
@@ -52941,57 +52942,17 @@ function createTypeChecker(host) {
|
|
|
52941
52942
|
context.reverseMappedStack.pop();
|
|
52942
52943
|
}
|
|
52943
52944
|
}
|
|
52944
|
-
|
|
52945
|
-
|
|
52946
|
-
|
|
52947
|
-
const getAccessorSignature = factory.createGetAccessorDeclaration(
|
|
52948
|
-
/*modifiers*/
|
|
52949
|
-
void 0,
|
|
52950
|
-
propertyName,
|
|
52951
|
-
[],
|
|
52952
|
-
propertyTypeNode,
|
|
52953
|
-
/*body*/
|
|
52954
|
-
void 0
|
|
52955
|
-
);
|
|
52956
|
-
setCommentRange(getAccessorSignature, getAccessorDecl);
|
|
52957
|
-
typeElements.push(getAccessorSignature);
|
|
52958
|
-
}
|
|
52959
|
-
if (propertySymbol.flags & 65536 /* SetAccessor */) {
|
|
52960
|
-
const setAccessorDecl = find(propertySymbol.declarations, (decl) => decl.kind === 178 /* SetAccessor */);
|
|
52961
|
-
const parameterName = ((_b = setAccessorDecl == null ? void 0 : setAccessorDecl.parameters) == null ? void 0 : _b.length) > 0 ? setAccessorDecl.parameters[0].name : "arg";
|
|
52962
|
-
const setAccessorSignature = factory.createSetAccessorDeclaration(
|
|
52963
|
-
/*modifiers*/
|
|
52964
|
-
void 0,
|
|
52965
|
-
propertyName,
|
|
52966
|
-
[factory.createParameterDeclaration(
|
|
52967
|
-
/*modifiers*/
|
|
52968
|
-
void 0,
|
|
52969
|
-
/*dotDotDotToken*/
|
|
52970
|
-
void 0,
|
|
52971
|
-
parameterName,
|
|
52972
|
-
/*questionToken*/
|
|
52973
|
-
void 0,
|
|
52974
|
-
propertyTypeNode
|
|
52975
|
-
)],
|
|
52976
|
-
/*body*/
|
|
52977
|
-
void 0
|
|
52978
|
-
);
|
|
52979
|
-
setCommentRange(setAccessorSignature, setAccessorDecl);
|
|
52980
|
-
typeElements.push(setAccessorSignature);
|
|
52981
|
-
}
|
|
52982
|
-
} else {
|
|
52983
|
-
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
52984
|
-
if (modifiers) {
|
|
52985
|
-
context.approximateLength += 9;
|
|
52986
|
-
}
|
|
52987
|
-
const propertySignature = factory.createPropertySignature(
|
|
52988
|
-
modifiers,
|
|
52989
|
-
propertyName,
|
|
52990
|
-
optionalToken,
|
|
52991
|
-
propertyTypeNode
|
|
52992
|
-
);
|
|
52993
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
52945
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
52946
|
+
if (modifiers) {
|
|
52947
|
+
context.approximateLength += 9;
|
|
52994
52948
|
}
|
|
52949
|
+
const propertySignature = factory.createPropertySignature(
|
|
52950
|
+
modifiers,
|
|
52951
|
+
propertyName,
|
|
52952
|
+
optionalToken,
|
|
52953
|
+
propertyTypeNode
|
|
52954
|
+
);
|
|
52955
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
52995
52956
|
function preserveCommentsOn(node) {
|
|
52996
52957
|
var _a2;
|
|
52997
52958
|
if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
|
|
@@ -56320,7 +56281,7 @@ function createTypeChecker(host) {
|
|
|
56320
56281
|
false,
|
|
56321
56282
|
definedInMethod && !definedInConstructor
|
|
56322
56283
|
));
|
|
56323
|
-
if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
56284
|
+
if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
56324
56285
|
reportImplicitAny(symbol.valueDeclaration, anyType);
|
|
56325
56286
|
return anyType;
|
|
56326
56287
|
}
|
|
@@ -57680,6 +57641,7 @@ function createTypeChecker(host) {
|
|
|
57680
57641
|
return links.resolvedSymbol;
|
|
57681
57642
|
}
|
|
57682
57643
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
57644
|
+
var _a, _b, _c;
|
|
57683
57645
|
const links = getSymbolLinks(symbol);
|
|
57684
57646
|
if (!links[resolutionKind]) {
|
|
57685
57647
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -57698,7 +57660,7 @@ function createTypeChecker(host) {
|
|
|
57698
57660
|
}
|
|
57699
57661
|
}
|
|
57700
57662
|
}
|
|
57701
|
-
const assignments = symbol.assignmentDeclarationMembers;
|
|
57663
|
+
const assignments = (((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */) && ((_c = getSymbolOfNode(symbol.valueDeclaration.parent)) == null ? void 0 : _c.assignmentDeclarationMembers) || symbol.assignmentDeclarationMembers;
|
|
57702
57664
|
if (assignments) {
|
|
57703
57665
|
const decls = arrayFrom(assignments.values());
|
|
57704
57666
|
for (const member of decls) {
|
|
@@ -57827,7 +57789,7 @@ function createTypeChecker(host) {
|
|
|
57827
57789
|
/*resolvedTypePredicate*/
|
|
57828
57790
|
void 0,
|
|
57829
57791
|
sig.minArgumentCount,
|
|
57830
|
-
sig.flags &
|
|
57792
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
57831
57793
|
);
|
|
57832
57794
|
result.target = sig.target;
|
|
57833
57795
|
result.mapper = sig.mapper;
|
|
@@ -58128,7 +58090,7 @@ function createTypeChecker(host) {
|
|
|
58128
58090
|
/*resolvedTypePredicate*/
|
|
58129
58091
|
void 0,
|
|
58130
58092
|
minArgCount,
|
|
58131
|
-
(left.flags | right.flags) &
|
|
58093
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
58132
58094
|
);
|
|
58133
58095
|
result.compositeKind = 1048576 /* Union */;
|
|
58134
58096
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -58338,7 +58300,7 @@ function createTypeChecker(host) {
|
|
|
58338
58300
|
/*resolvedTypePredicate*/
|
|
58339
58301
|
void 0,
|
|
58340
58302
|
sig.minArgumentCount,
|
|
58341
|
-
sig.flags &
|
|
58303
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
58342
58304
|
) : void 0
|
|
58343
58305
|
));
|
|
58344
58306
|
}
|
|
@@ -63121,7 +63083,7 @@ function createTypeChecker(host) {
|
|
|
63121
63083
|
/*resolvedTypePredicate*/
|
|
63122
63084
|
void 0,
|
|
63123
63085
|
signature.minArgumentCount,
|
|
63124
|
-
signature.flags &
|
|
63086
|
+
signature.flags & 167 /* PropagatingFlags */
|
|
63125
63087
|
);
|
|
63126
63088
|
result.target = signature;
|
|
63127
63089
|
result.mapper = mapper;
|
|
@@ -70382,12 +70344,15 @@ function createTypeChecker(host) {
|
|
|
70382
70344
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
70383
70345
|
}
|
|
70384
70346
|
const target = getReferenceCandidate(expr.right);
|
|
70385
|
-
|
|
70386
|
-
|
|
70387
|
-
if (
|
|
70347
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
|
|
70348
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
70349
|
+
if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
70388
70350
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
70389
70351
|
}
|
|
70390
|
-
|
|
70352
|
+
}
|
|
70353
|
+
if (isMatchingReference(reference, target)) {
|
|
70354
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
70355
|
+
if (isTypeUsableAsPropertyName(leftType)) {
|
|
70391
70356
|
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
70392
70357
|
}
|
|
70393
70358
|
}
|
|
@@ -72570,7 +72535,7 @@ function createTypeChecker(host) {
|
|
|
72570
72535
|
/*resolvedTypePredicate*/
|
|
72571
72536
|
void 0,
|
|
72572
72537
|
minArgCount,
|
|
72573
|
-
(left.flags | right.flags) &
|
|
72538
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
72574
72539
|
);
|
|
72575
72540
|
result.compositeKind = 2097152 /* Intersection */;
|
|
72576
72541
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -74104,7 +74069,7 @@ function createTypeChecker(host) {
|
|
|
74104
74069
|
}
|
|
74105
74070
|
let diagnosticMessage;
|
|
74106
74071
|
const declarationName = idText(right);
|
|
74107
|
-
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (
|
|
74072
|
+
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
74108
74073
|
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
74109
74074
|
} else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
74110
74075
|
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
@@ -75599,7 +75564,7 @@ function createTypeChecker(host) {
|
|
|
75599
75564
|
parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i))));
|
|
75600
75565
|
}
|
|
75601
75566
|
const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0);
|
|
75602
|
-
let flags =
|
|
75567
|
+
let flags = 128 /* IsSignatureCandidateForOverloadFailure */;
|
|
75603
75568
|
if (restParameterSymbols.length !== 0) {
|
|
75604
75569
|
const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */));
|
|
75605
75570
|
parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
|
|
@@ -76323,6 +76288,8 @@ function createTypeChecker(host) {
|
|
|
76323
76288
|
return returnType;
|
|
76324
76289
|
}
|
|
76325
76290
|
function checkDeprecatedSignature(signature, node) {
|
|
76291
|
+
if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */)
|
|
76292
|
+
return;
|
|
76326
76293
|
if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) {
|
|
76327
76294
|
const suggestionNode = getDeprecatedSuggestionNode(node);
|
|
76328
76295
|
const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node));
|
|
@@ -79796,7 +79763,7 @@ function createTypeChecker(host) {
|
|
|
79796
79763
|
case "length":
|
|
79797
79764
|
case "caller":
|
|
79798
79765
|
case "arguments":
|
|
79799
|
-
if (
|
|
79766
|
+
if (useDefineForClassFields) {
|
|
79800
79767
|
break;
|
|
79801
79768
|
}
|
|
79802
79769
|
case "prototype":
|
|
@@ -79944,7 +79911,7 @@ function createTypeChecker(host) {
|
|
|
79944
79911
|
if (classExtendsNull) {
|
|
79945
79912
|
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
79946
79913
|
}
|
|
79947
|
-
const superCallShouldBeRootLevel =
|
|
79914
|
+
const superCallShouldBeRootLevel = !useDefineForClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
79948
79915
|
if (superCallShouldBeRootLevel) {
|
|
79949
79916
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
79950
79917
|
error2(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
@@ -83214,7 +83181,7 @@ function createTypeChecker(host) {
|
|
|
83214
83181
|
node
|
|
83215
83182
|
);
|
|
83216
83183
|
const willTransformPrivateElementsOrClassStaticBlocks = languageVersion <= 9 /* ES2022 */;
|
|
83217
|
-
const willTransformInitializers = !useDefineForClassFields
|
|
83184
|
+
const willTransformInitializers = !useDefineForClassFields;
|
|
83218
83185
|
if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
|
|
83219
83186
|
for (const member of node.members) {
|
|
83220
83187
|
if (willTransformStaticElementsOfDecoratedClass && classElementOrClassElementParameterIsDecorated(
|
|
@@ -159173,7 +159140,8 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159173
159140
|
const leftMostName = getLeftMostName(computedPropertyName.expression);
|
|
159174
159141
|
const nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName);
|
|
159175
159142
|
const firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker);
|
|
159176
|
-
|
|
159143
|
+
const firstAccessibleSymbolId = firstAccessibleSymbol && getSymbolId(firstAccessibleSymbol);
|
|
159144
|
+
if (firstAccessibleSymbolId && addToSeen(seenPropertySymbols, firstAccessibleSymbolId)) {
|
|
159177
159145
|
const index = symbols.length;
|
|
159178
159146
|
symbols.push(firstAccessibleSymbol);
|
|
159179
159147
|
const moduleSymbol = firstAccessibleSymbol.parent;
|
|
@@ -159203,6 +159171,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159203
159171
|
}
|
|
159204
159172
|
}
|
|
159205
159173
|
} else if (preferences.includeCompletionsWithInsertText) {
|
|
159174
|
+
if (firstAccessibleSymbolId && seenPropertySymbols.has(firstAccessibleSymbolId)) {
|
|
159175
|
+
return;
|
|
159176
|
+
}
|
|
159206
159177
|
addSymbolOriginInfo(symbol);
|
|
159207
159178
|
addSymbolSortInfo(symbol);
|
|
159208
159179
|
symbols.push(symbol);
|
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.20230720`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4576,7 +4576,8 @@ ${lanes.join("\n")}
|
|
|
4576
4576
|
SignatureFlags5[SignatureFlags5["IsOuterCallChain"] = 16] = "IsOuterCallChain";
|
|
4577
4577
|
SignatureFlags5[SignatureFlags5["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
|
|
4578
4578
|
SignatureFlags5[SignatureFlags5["IsNonInferrable"] = 64] = "IsNonInferrable";
|
|
4579
|
-
SignatureFlags5[SignatureFlags5["
|
|
4579
|
+
SignatureFlags5[SignatureFlags5["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
|
|
4580
|
+
SignatureFlags5[SignatureFlags5["PropagatingFlags"] = 167] = "PropagatingFlags";
|
|
4580
4581
|
SignatureFlags5[SignatureFlags5["CallChainFlags"] = 24] = "CallChainFlags";
|
|
4581
4582
|
return SignatureFlags5;
|
|
4582
4583
|
})(SignatureFlags || {});
|
|
@@ -46848,7 +46849,7 @@ ${lanes.join("\n")}
|
|
|
46848
46849
|
false
|
|
46849
46850
|
);
|
|
46850
46851
|
} else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
46851
|
-
return !(
|
|
46852
|
+
return !(useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration));
|
|
46852
46853
|
}
|
|
46853
46854
|
return true;
|
|
46854
46855
|
}
|
|
@@ -46862,7 +46863,7 @@ ${lanes.join("\n")}
|
|
|
46862
46863
|
return true;
|
|
46863
46864
|
}
|
|
46864
46865
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
46865
|
-
if (
|
|
46866
|
+
if (useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
46866
46867
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
46867
46868
|
declaration,
|
|
46868
46869
|
usage,
|
|
@@ -46986,7 +46987,7 @@ ${lanes.join("\n")}
|
|
|
46986
46987
|
return requiresScopeChangeWorker(node.name);
|
|
46987
46988
|
case 172 /* PropertyDeclaration */:
|
|
46988
46989
|
if (hasStaticModifier(node)) {
|
|
46989
|
-
return
|
|
46990
|
+
return !useDefineForClassFields;
|
|
46990
46991
|
}
|
|
46991
46992
|
return requiresScopeChangeWorker(node.name);
|
|
46992
46993
|
default:
|
|
@@ -47025,7 +47026,7 @@ ${lanes.join("\n")}
|
|
|
47025
47026
|
if (name === "const" && isConstAssertion(location)) {
|
|
47026
47027
|
return void 0;
|
|
47027
47028
|
}
|
|
47028
|
-
if (
|
|
47029
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
47029
47030
|
lastLocation = location;
|
|
47030
47031
|
location = location.parent;
|
|
47031
47032
|
}
|
|
@@ -47257,7 +47258,7 @@ ${lanes.join("\n")}
|
|
|
47257
47258
|
}
|
|
47258
47259
|
}
|
|
47259
47260
|
function checkAndReportErrorForInvalidInitializer() {
|
|
47260
|
-
if (propertyWithInvalidInitializer && !
|
|
47261
|
+
if (propertyWithInvalidInitializer && !useDefineForClassFields) {
|
|
47261
47262
|
error2(
|
|
47262
47263
|
errorLocation,
|
|
47263
47264
|
errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
|
|
@@ -50658,7 +50659,7 @@ ${lanes.join("\n")}
|
|
|
50658
50659
|
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
|
|
50659
50660
|
}
|
|
50660
50661
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
50661
|
-
var _a
|
|
50662
|
+
var _a;
|
|
50662
50663
|
const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
|
|
50663
50664
|
const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
50664
50665
|
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
@@ -50708,57 +50709,17 @@ ${lanes.join("\n")}
|
|
|
50708
50709
|
context.reverseMappedStack.pop();
|
|
50709
50710
|
}
|
|
50710
50711
|
}
|
|
50711
|
-
|
|
50712
|
-
|
|
50713
|
-
|
|
50714
|
-
const getAccessorSignature = factory.createGetAccessorDeclaration(
|
|
50715
|
-
/*modifiers*/
|
|
50716
|
-
void 0,
|
|
50717
|
-
propertyName,
|
|
50718
|
-
[],
|
|
50719
|
-
propertyTypeNode,
|
|
50720
|
-
/*body*/
|
|
50721
|
-
void 0
|
|
50722
|
-
);
|
|
50723
|
-
setCommentRange(getAccessorSignature, getAccessorDecl);
|
|
50724
|
-
typeElements.push(getAccessorSignature);
|
|
50725
|
-
}
|
|
50726
|
-
if (propertySymbol.flags & 65536 /* SetAccessor */) {
|
|
50727
|
-
const setAccessorDecl = find(propertySymbol.declarations, (decl) => decl.kind === 178 /* SetAccessor */);
|
|
50728
|
-
const parameterName = ((_b = setAccessorDecl == null ? void 0 : setAccessorDecl.parameters) == null ? void 0 : _b.length) > 0 ? setAccessorDecl.parameters[0].name : "arg";
|
|
50729
|
-
const setAccessorSignature = factory.createSetAccessorDeclaration(
|
|
50730
|
-
/*modifiers*/
|
|
50731
|
-
void 0,
|
|
50732
|
-
propertyName,
|
|
50733
|
-
[factory.createParameterDeclaration(
|
|
50734
|
-
/*modifiers*/
|
|
50735
|
-
void 0,
|
|
50736
|
-
/*dotDotDotToken*/
|
|
50737
|
-
void 0,
|
|
50738
|
-
parameterName,
|
|
50739
|
-
/*questionToken*/
|
|
50740
|
-
void 0,
|
|
50741
|
-
propertyTypeNode
|
|
50742
|
-
)],
|
|
50743
|
-
/*body*/
|
|
50744
|
-
void 0
|
|
50745
|
-
);
|
|
50746
|
-
setCommentRange(setAccessorSignature, setAccessorDecl);
|
|
50747
|
-
typeElements.push(setAccessorSignature);
|
|
50748
|
-
}
|
|
50749
|
-
} else {
|
|
50750
|
-
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
50751
|
-
if (modifiers) {
|
|
50752
|
-
context.approximateLength += 9;
|
|
50753
|
-
}
|
|
50754
|
-
const propertySignature = factory.createPropertySignature(
|
|
50755
|
-
modifiers,
|
|
50756
|
-
propertyName,
|
|
50757
|
-
optionalToken,
|
|
50758
|
-
propertyTypeNode
|
|
50759
|
-
);
|
|
50760
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50712
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
50713
|
+
if (modifiers) {
|
|
50714
|
+
context.approximateLength += 9;
|
|
50761
50715
|
}
|
|
50716
|
+
const propertySignature = factory.createPropertySignature(
|
|
50717
|
+
modifiers,
|
|
50718
|
+
propertyName,
|
|
50719
|
+
optionalToken,
|
|
50720
|
+
propertyTypeNode
|
|
50721
|
+
);
|
|
50722
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50762
50723
|
function preserveCommentsOn(node) {
|
|
50763
50724
|
var _a2;
|
|
50764
50725
|
if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
|
|
@@ -54087,7 +54048,7 @@ ${lanes.join("\n")}
|
|
|
54087
54048
|
false,
|
|
54088
54049
|
definedInMethod && !definedInConstructor
|
|
54089
54050
|
));
|
|
54090
|
-
if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
54051
|
+
if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
54091
54052
|
reportImplicitAny(symbol.valueDeclaration, anyType);
|
|
54092
54053
|
return anyType;
|
|
54093
54054
|
}
|
|
@@ -55447,6 +55408,7 @@ ${lanes.join("\n")}
|
|
|
55447
55408
|
return links.resolvedSymbol;
|
|
55448
55409
|
}
|
|
55449
55410
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
55411
|
+
var _a, _b, _c;
|
|
55450
55412
|
const links = getSymbolLinks(symbol);
|
|
55451
55413
|
if (!links[resolutionKind]) {
|
|
55452
55414
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -55465,7 +55427,7 @@ ${lanes.join("\n")}
|
|
|
55465
55427
|
}
|
|
55466
55428
|
}
|
|
55467
55429
|
}
|
|
55468
|
-
const assignments = symbol.assignmentDeclarationMembers;
|
|
55430
|
+
const assignments = (((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */) && ((_c = getSymbolOfNode(symbol.valueDeclaration.parent)) == null ? void 0 : _c.assignmentDeclarationMembers) || symbol.assignmentDeclarationMembers;
|
|
55469
55431
|
if (assignments) {
|
|
55470
55432
|
const decls = arrayFrom(assignments.values());
|
|
55471
55433
|
for (const member of decls) {
|
|
@@ -55594,7 +55556,7 @@ ${lanes.join("\n")}
|
|
|
55594
55556
|
/*resolvedTypePredicate*/
|
|
55595
55557
|
void 0,
|
|
55596
55558
|
sig.minArgumentCount,
|
|
55597
|
-
sig.flags &
|
|
55559
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
55598
55560
|
);
|
|
55599
55561
|
result.target = sig.target;
|
|
55600
55562
|
result.mapper = sig.mapper;
|
|
@@ -55895,7 +55857,7 @@ ${lanes.join("\n")}
|
|
|
55895
55857
|
/*resolvedTypePredicate*/
|
|
55896
55858
|
void 0,
|
|
55897
55859
|
minArgCount,
|
|
55898
|
-
(left.flags | right.flags) &
|
|
55860
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
55899
55861
|
);
|
|
55900
55862
|
result.compositeKind = 1048576 /* Union */;
|
|
55901
55863
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -56105,7 +56067,7 @@ ${lanes.join("\n")}
|
|
|
56105
56067
|
/*resolvedTypePredicate*/
|
|
56106
56068
|
void 0,
|
|
56107
56069
|
sig.minArgumentCount,
|
|
56108
|
-
sig.flags &
|
|
56070
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
56109
56071
|
) : void 0
|
|
56110
56072
|
));
|
|
56111
56073
|
}
|
|
@@ -60888,7 +60850,7 @@ ${lanes.join("\n")}
|
|
|
60888
60850
|
/*resolvedTypePredicate*/
|
|
60889
60851
|
void 0,
|
|
60890
60852
|
signature.minArgumentCount,
|
|
60891
|
-
signature.flags &
|
|
60853
|
+
signature.flags & 167 /* PropagatingFlags */
|
|
60892
60854
|
);
|
|
60893
60855
|
result.target = signature;
|
|
60894
60856
|
result.mapper = mapper;
|
|
@@ -68149,12 +68111,15 @@ ${lanes.join("\n")}
|
|
|
68149
68111
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
68150
68112
|
}
|
|
68151
68113
|
const target = getReferenceCandidate(expr.right);
|
|
68152
|
-
|
|
68153
|
-
|
|
68154
|
-
if (
|
|
68114
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
|
|
68115
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
68116
|
+
if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
68155
68117
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
68156
68118
|
}
|
|
68157
|
-
|
|
68119
|
+
}
|
|
68120
|
+
if (isMatchingReference(reference, target)) {
|
|
68121
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
68122
|
+
if (isTypeUsableAsPropertyName(leftType)) {
|
|
68158
68123
|
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
68159
68124
|
}
|
|
68160
68125
|
}
|
|
@@ -70337,7 +70302,7 @@ ${lanes.join("\n")}
|
|
|
70337
70302
|
/*resolvedTypePredicate*/
|
|
70338
70303
|
void 0,
|
|
70339
70304
|
minArgCount,
|
|
70340
|
-
(left.flags | right.flags) &
|
|
70305
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
70341
70306
|
);
|
|
70342
70307
|
result.compositeKind = 2097152 /* Intersection */;
|
|
70343
70308
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -71871,7 +71836,7 @@ ${lanes.join("\n")}
|
|
|
71871
71836
|
}
|
|
71872
71837
|
let diagnosticMessage;
|
|
71873
71838
|
const declarationName = idText(right);
|
|
71874
|
-
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (
|
|
71839
|
+
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
71875
71840
|
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
71876
71841
|
} else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
71877
71842
|
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
@@ -73366,7 +73331,7 @@ ${lanes.join("\n")}
|
|
|
73366
73331
|
parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i))));
|
|
73367
73332
|
}
|
|
73368
73333
|
const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0);
|
|
73369
|
-
let flags =
|
|
73334
|
+
let flags = 128 /* IsSignatureCandidateForOverloadFailure */;
|
|
73370
73335
|
if (restParameterSymbols.length !== 0) {
|
|
73371
73336
|
const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */));
|
|
73372
73337
|
parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
|
|
@@ -74090,6 +74055,8 @@ ${lanes.join("\n")}
|
|
|
74090
74055
|
return returnType;
|
|
74091
74056
|
}
|
|
74092
74057
|
function checkDeprecatedSignature(signature, node) {
|
|
74058
|
+
if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */)
|
|
74059
|
+
return;
|
|
74093
74060
|
if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) {
|
|
74094
74061
|
const suggestionNode = getDeprecatedSuggestionNode(node);
|
|
74095
74062
|
const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node));
|
|
@@ -77563,7 +77530,7 @@ ${lanes.join("\n")}
|
|
|
77563
77530
|
case "length":
|
|
77564
77531
|
case "caller":
|
|
77565
77532
|
case "arguments":
|
|
77566
|
-
if (
|
|
77533
|
+
if (useDefineForClassFields) {
|
|
77567
77534
|
break;
|
|
77568
77535
|
}
|
|
77569
77536
|
case "prototype":
|
|
@@ -77711,7 +77678,7 @@ ${lanes.join("\n")}
|
|
|
77711
77678
|
if (classExtendsNull) {
|
|
77712
77679
|
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
77713
77680
|
}
|
|
77714
|
-
const superCallShouldBeRootLevel =
|
|
77681
|
+
const superCallShouldBeRootLevel = !useDefineForClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
77715
77682
|
if (superCallShouldBeRootLevel) {
|
|
77716
77683
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
77717
77684
|
error2(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
@@ -80981,7 +80948,7 @@ ${lanes.join("\n")}
|
|
|
80981
80948
|
node
|
|
80982
80949
|
);
|
|
80983
80950
|
const willTransformPrivateElementsOrClassStaticBlocks = languageVersion <= 9 /* ES2022 */;
|
|
80984
|
-
const willTransformInitializers = !useDefineForClassFields
|
|
80951
|
+
const willTransformInitializers = !useDefineForClassFields;
|
|
80985
80952
|
if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
|
|
80986
80953
|
for (const member of node.members) {
|
|
80987
80954
|
if (willTransformStaticElementsOfDecoratedClass && classElementOrClassElementParameterIsDecorated(
|
|
@@ -158396,7 +158363,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158396
158363
|
const leftMostName = getLeftMostName(computedPropertyName.expression);
|
|
158397
158364
|
const nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName);
|
|
158398
158365
|
const firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker);
|
|
158399
|
-
|
|
158366
|
+
const firstAccessibleSymbolId = firstAccessibleSymbol && getSymbolId(firstAccessibleSymbol);
|
|
158367
|
+
if (firstAccessibleSymbolId && addToSeen(seenPropertySymbols, firstAccessibleSymbolId)) {
|
|
158400
158368
|
const index = symbols.length;
|
|
158401
158369
|
symbols.push(firstAccessibleSymbol);
|
|
158402
158370
|
const moduleSymbol = firstAccessibleSymbol.parent;
|
|
@@ -158426,6 +158394,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158426
158394
|
}
|
|
158427
158395
|
}
|
|
158428
158396
|
} else if (preferences.includeCompletionsWithInsertText) {
|
|
158397
|
+
if (firstAccessibleSymbolId && seenPropertySymbols.has(firstAccessibleSymbolId)) {
|
|
158398
|
+
return;
|
|
158399
|
+
}
|
|
158429
158400
|
addSymbolOriginInfo(symbol);
|
|
158430
158401
|
addSymbolSortInfo(symbol);
|
|
158431
158402
|
symbols.push(symbol);
|
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.20230720`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4576,7 +4576,8 @@ ${lanes.join("\n")}
|
|
|
4576
4576
|
SignatureFlags5[SignatureFlags5["IsOuterCallChain"] = 16] = "IsOuterCallChain";
|
|
4577
4577
|
SignatureFlags5[SignatureFlags5["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
|
|
4578
4578
|
SignatureFlags5[SignatureFlags5["IsNonInferrable"] = 64] = "IsNonInferrable";
|
|
4579
|
-
SignatureFlags5[SignatureFlags5["
|
|
4579
|
+
SignatureFlags5[SignatureFlags5["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
|
|
4580
|
+
SignatureFlags5[SignatureFlags5["PropagatingFlags"] = 167] = "PropagatingFlags";
|
|
4580
4581
|
SignatureFlags5[SignatureFlags5["CallChainFlags"] = 24] = "CallChainFlags";
|
|
4581
4582
|
return SignatureFlags5;
|
|
4582
4583
|
})(SignatureFlags || {});
|
|
@@ -46848,7 +46849,7 @@ ${lanes.join("\n")}
|
|
|
46848
46849
|
false
|
|
46849
46850
|
);
|
|
46850
46851
|
} else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
46851
|
-
return !(
|
|
46852
|
+
return !(useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration));
|
|
46852
46853
|
}
|
|
46853
46854
|
return true;
|
|
46854
46855
|
}
|
|
@@ -46862,7 +46863,7 @@ ${lanes.join("\n")}
|
|
|
46862
46863
|
return true;
|
|
46863
46864
|
}
|
|
46864
46865
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
46865
|
-
if (
|
|
46866
|
+
if (useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
46866
46867
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
46867
46868
|
declaration,
|
|
46868
46869
|
usage,
|
|
@@ -46986,7 +46987,7 @@ ${lanes.join("\n")}
|
|
|
46986
46987
|
return requiresScopeChangeWorker(node.name);
|
|
46987
46988
|
case 172 /* PropertyDeclaration */:
|
|
46988
46989
|
if (hasStaticModifier(node)) {
|
|
46989
|
-
return
|
|
46990
|
+
return !useDefineForClassFields;
|
|
46990
46991
|
}
|
|
46991
46992
|
return requiresScopeChangeWorker(node.name);
|
|
46992
46993
|
default:
|
|
@@ -47025,7 +47026,7 @@ ${lanes.join("\n")}
|
|
|
47025
47026
|
if (name === "const" && isConstAssertion(location)) {
|
|
47026
47027
|
return void 0;
|
|
47027
47028
|
}
|
|
47028
|
-
if (
|
|
47029
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
47029
47030
|
lastLocation = location;
|
|
47030
47031
|
location = location.parent;
|
|
47031
47032
|
}
|
|
@@ -47257,7 +47258,7 @@ ${lanes.join("\n")}
|
|
|
47257
47258
|
}
|
|
47258
47259
|
}
|
|
47259
47260
|
function checkAndReportErrorForInvalidInitializer() {
|
|
47260
|
-
if (propertyWithInvalidInitializer && !
|
|
47261
|
+
if (propertyWithInvalidInitializer && !useDefineForClassFields) {
|
|
47261
47262
|
error2(
|
|
47262
47263
|
errorLocation,
|
|
47263
47264
|
errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
|
|
@@ -50658,7 +50659,7 @@ ${lanes.join("\n")}
|
|
|
50658
50659
|
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
|
|
50659
50660
|
}
|
|
50660
50661
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
50661
|
-
var _a
|
|
50662
|
+
var _a;
|
|
50662
50663
|
const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
|
|
50663
50664
|
const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
50664
50665
|
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
@@ -50708,57 +50709,17 @@ ${lanes.join("\n")}
|
|
|
50708
50709
|
context.reverseMappedStack.pop();
|
|
50709
50710
|
}
|
|
50710
50711
|
}
|
|
50711
|
-
|
|
50712
|
-
|
|
50713
|
-
|
|
50714
|
-
const getAccessorSignature = factory.createGetAccessorDeclaration(
|
|
50715
|
-
/*modifiers*/
|
|
50716
|
-
void 0,
|
|
50717
|
-
propertyName,
|
|
50718
|
-
[],
|
|
50719
|
-
propertyTypeNode,
|
|
50720
|
-
/*body*/
|
|
50721
|
-
void 0
|
|
50722
|
-
);
|
|
50723
|
-
setCommentRange(getAccessorSignature, getAccessorDecl);
|
|
50724
|
-
typeElements.push(getAccessorSignature);
|
|
50725
|
-
}
|
|
50726
|
-
if (propertySymbol.flags & 65536 /* SetAccessor */) {
|
|
50727
|
-
const setAccessorDecl = find(propertySymbol.declarations, (decl) => decl.kind === 178 /* SetAccessor */);
|
|
50728
|
-
const parameterName = ((_b = setAccessorDecl == null ? void 0 : setAccessorDecl.parameters) == null ? void 0 : _b.length) > 0 ? setAccessorDecl.parameters[0].name : "arg";
|
|
50729
|
-
const setAccessorSignature = factory.createSetAccessorDeclaration(
|
|
50730
|
-
/*modifiers*/
|
|
50731
|
-
void 0,
|
|
50732
|
-
propertyName,
|
|
50733
|
-
[factory.createParameterDeclaration(
|
|
50734
|
-
/*modifiers*/
|
|
50735
|
-
void 0,
|
|
50736
|
-
/*dotDotDotToken*/
|
|
50737
|
-
void 0,
|
|
50738
|
-
parameterName,
|
|
50739
|
-
/*questionToken*/
|
|
50740
|
-
void 0,
|
|
50741
|
-
propertyTypeNode
|
|
50742
|
-
)],
|
|
50743
|
-
/*body*/
|
|
50744
|
-
void 0
|
|
50745
|
-
);
|
|
50746
|
-
setCommentRange(setAccessorSignature, setAccessorDecl);
|
|
50747
|
-
typeElements.push(setAccessorSignature);
|
|
50748
|
-
}
|
|
50749
|
-
} else {
|
|
50750
|
-
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
50751
|
-
if (modifiers) {
|
|
50752
|
-
context.approximateLength += 9;
|
|
50753
|
-
}
|
|
50754
|
-
const propertySignature = factory.createPropertySignature(
|
|
50755
|
-
modifiers,
|
|
50756
|
-
propertyName,
|
|
50757
|
-
optionalToken,
|
|
50758
|
-
propertyTypeNode
|
|
50759
|
-
);
|
|
50760
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50712
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
50713
|
+
if (modifiers) {
|
|
50714
|
+
context.approximateLength += 9;
|
|
50761
50715
|
}
|
|
50716
|
+
const propertySignature = factory.createPropertySignature(
|
|
50717
|
+
modifiers,
|
|
50718
|
+
propertyName,
|
|
50719
|
+
optionalToken,
|
|
50720
|
+
propertyTypeNode
|
|
50721
|
+
);
|
|
50722
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50762
50723
|
function preserveCommentsOn(node) {
|
|
50763
50724
|
var _a2;
|
|
50764
50725
|
if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
|
|
@@ -54087,7 +54048,7 @@ ${lanes.join("\n")}
|
|
|
54087
54048
|
false,
|
|
54088
54049
|
definedInMethod && !definedInConstructor
|
|
54089
54050
|
));
|
|
54090
|
-
if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
54051
|
+
if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
54091
54052
|
reportImplicitAny(symbol.valueDeclaration, anyType);
|
|
54092
54053
|
return anyType;
|
|
54093
54054
|
}
|
|
@@ -55447,6 +55408,7 @@ ${lanes.join("\n")}
|
|
|
55447
55408
|
return links.resolvedSymbol;
|
|
55448
55409
|
}
|
|
55449
55410
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
55411
|
+
var _a, _b, _c;
|
|
55450
55412
|
const links = getSymbolLinks(symbol);
|
|
55451
55413
|
if (!links[resolutionKind]) {
|
|
55452
55414
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -55465,7 +55427,7 @@ ${lanes.join("\n")}
|
|
|
55465
55427
|
}
|
|
55466
55428
|
}
|
|
55467
55429
|
}
|
|
55468
|
-
const assignments = symbol.assignmentDeclarationMembers;
|
|
55430
|
+
const assignments = (((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */) && ((_c = getSymbolOfNode(symbol.valueDeclaration.parent)) == null ? void 0 : _c.assignmentDeclarationMembers) || symbol.assignmentDeclarationMembers;
|
|
55469
55431
|
if (assignments) {
|
|
55470
55432
|
const decls = arrayFrom(assignments.values());
|
|
55471
55433
|
for (const member of decls) {
|
|
@@ -55594,7 +55556,7 @@ ${lanes.join("\n")}
|
|
|
55594
55556
|
/*resolvedTypePredicate*/
|
|
55595
55557
|
void 0,
|
|
55596
55558
|
sig.minArgumentCount,
|
|
55597
|
-
sig.flags &
|
|
55559
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
55598
55560
|
);
|
|
55599
55561
|
result.target = sig.target;
|
|
55600
55562
|
result.mapper = sig.mapper;
|
|
@@ -55895,7 +55857,7 @@ ${lanes.join("\n")}
|
|
|
55895
55857
|
/*resolvedTypePredicate*/
|
|
55896
55858
|
void 0,
|
|
55897
55859
|
minArgCount,
|
|
55898
|
-
(left.flags | right.flags) &
|
|
55860
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
55899
55861
|
);
|
|
55900
55862
|
result.compositeKind = 1048576 /* Union */;
|
|
55901
55863
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -56105,7 +56067,7 @@ ${lanes.join("\n")}
|
|
|
56105
56067
|
/*resolvedTypePredicate*/
|
|
56106
56068
|
void 0,
|
|
56107
56069
|
sig.minArgumentCount,
|
|
56108
|
-
sig.flags &
|
|
56070
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
56109
56071
|
) : void 0
|
|
56110
56072
|
));
|
|
56111
56073
|
}
|
|
@@ -60888,7 +60850,7 @@ ${lanes.join("\n")}
|
|
|
60888
60850
|
/*resolvedTypePredicate*/
|
|
60889
60851
|
void 0,
|
|
60890
60852
|
signature.minArgumentCount,
|
|
60891
|
-
signature.flags &
|
|
60853
|
+
signature.flags & 167 /* PropagatingFlags */
|
|
60892
60854
|
);
|
|
60893
60855
|
result.target = signature;
|
|
60894
60856
|
result.mapper = mapper;
|
|
@@ -68149,12 +68111,15 @@ ${lanes.join("\n")}
|
|
|
68149
68111
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
68150
68112
|
}
|
|
68151
68113
|
const target = getReferenceCandidate(expr.right);
|
|
68152
|
-
|
|
68153
|
-
|
|
68154
|
-
if (
|
|
68114
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
|
|
68115
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
68116
|
+
if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
68155
68117
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
68156
68118
|
}
|
|
68157
|
-
|
|
68119
|
+
}
|
|
68120
|
+
if (isMatchingReference(reference, target)) {
|
|
68121
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
68122
|
+
if (isTypeUsableAsPropertyName(leftType)) {
|
|
68158
68123
|
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
68159
68124
|
}
|
|
68160
68125
|
}
|
|
@@ -70337,7 +70302,7 @@ ${lanes.join("\n")}
|
|
|
70337
70302
|
/*resolvedTypePredicate*/
|
|
70338
70303
|
void 0,
|
|
70339
70304
|
minArgCount,
|
|
70340
|
-
(left.flags | right.flags) &
|
|
70305
|
+
(left.flags | right.flags) & 167 /* PropagatingFlags */
|
|
70341
70306
|
);
|
|
70342
70307
|
result.compositeKind = 2097152 /* Intersection */;
|
|
70343
70308
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -71871,7 +71836,7 @@ ${lanes.join("\n")}
|
|
|
71871
71836
|
}
|
|
71872
71837
|
let diagnosticMessage;
|
|
71873
71838
|
const declarationName = idText(right);
|
|
71874
|
-
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (
|
|
71839
|
+
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
71875
71840
|
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
71876
71841
|
} else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
71877
71842
|
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
@@ -73366,7 +73331,7 @@ ${lanes.join("\n")}
|
|
|
73366
73331
|
parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i))));
|
|
73367
73332
|
}
|
|
73368
73333
|
const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0);
|
|
73369
|
-
let flags =
|
|
73334
|
+
let flags = 128 /* IsSignatureCandidateForOverloadFailure */;
|
|
73370
73335
|
if (restParameterSymbols.length !== 0) {
|
|
73371
73336
|
const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */));
|
|
73372
73337
|
parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
|
|
@@ -74090,6 +74055,8 @@ ${lanes.join("\n")}
|
|
|
74090
74055
|
return returnType;
|
|
74091
74056
|
}
|
|
74092
74057
|
function checkDeprecatedSignature(signature, node) {
|
|
74058
|
+
if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */)
|
|
74059
|
+
return;
|
|
74093
74060
|
if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) {
|
|
74094
74061
|
const suggestionNode = getDeprecatedSuggestionNode(node);
|
|
74095
74062
|
const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node));
|
|
@@ -77563,7 +77530,7 @@ ${lanes.join("\n")}
|
|
|
77563
77530
|
case "length":
|
|
77564
77531
|
case "caller":
|
|
77565
77532
|
case "arguments":
|
|
77566
|
-
if (
|
|
77533
|
+
if (useDefineForClassFields) {
|
|
77567
77534
|
break;
|
|
77568
77535
|
}
|
|
77569
77536
|
case "prototype":
|
|
@@ -77711,7 +77678,7 @@ ${lanes.join("\n")}
|
|
|
77711
77678
|
if (classExtendsNull) {
|
|
77712
77679
|
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
77713
77680
|
}
|
|
77714
|
-
const superCallShouldBeRootLevel =
|
|
77681
|
+
const superCallShouldBeRootLevel = !useDefineForClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */)));
|
|
77715
77682
|
if (superCallShouldBeRootLevel) {
|
|
77716
77683
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
77717
77684
|
error2(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
@@ -80981,7 +80948,7 @@ ${lanes.join("\n")}
|
|
|
80981
80948
|
node
|
|
80982
80949
|
);
|
|
80983
80950
|
const willTransformPrivateElementsOrClassStaticBlocks = languageVersion <= 9 /* ES2022 */;
|
|
80984
|
-
const willTransformInitializers = !useDefineForClassFields
|
|
80951
|
+
const willTransformInitializers = !useDefineForClassFields;
|
|
80985
80952
|
if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
|
|
80986
80953
|
for (const member of node.members) {
|
|
80987
80954
|
if (willTransformStaticElementsOfDecoratedClass && classElementOrClassElementParameterIsDecorated(
|
|
@@ -158411,7 +158378,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158411
158378
|
const leftMostName = getLeftMostName(computedPropertyName.expression);
|
|
158412
158379
|
const nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName);
|
|
158413
158380
|
const firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker);
|
|
158414
|
-
|
|
158381
|
+
const firstAccessibleSymbolId = firstAccessibleSymbol && getSymbolId(firstAccessibleSymbol);
|
|
158382
|
+
if (firstAccessibleSymbolId && addToSeen(seenPropertySymbols, firstAccessibleSymbolId)) {
|
|
158415
158383
|
const index = symbols.length;
|
|
158416
158384
|
symbols.push(firstAccessibleSymbol);
|
|
158417
158385
|
const moduleSymbol = firstAccessibleSymbol.parent;
|
|
@@ -158441,6 +158409,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158441
158409
|
}
|
|
158442
158410
|
}
|
|
158443
158411
|
} else if (preferences.includeCompletionsWithInsertText) {
|
|
158412
|
+
if (firstAccessibleSymbolId && seenPropertySymbols.has(firstAccessibleSymbolId)) {
|
|
158413
|
+
return;
|
|
158414
|
+
}
|
|
158444
158415
|
addSymbolOriginInfo(symbol);
|
|
158445
158416
|
addSymbolSortInfo(symbol);
|
|
158446
158417
|
symbols.push(symbol);
|
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.20230720`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3193,7 +3193,8 @@ var SignatureFlags = /* @__PURE__ */ ((SignatureFlags4) => {
|
|
|
3193
3193
|
SignatureFlags4[SignatureFlags4["IsOuterCallChain"] = 16] = "IsOuterCallChain";
|
|
3194
3194
|
SignatureFlags4[SignatureFlags4["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile";
|
|
3195
3195
|
SignatureFlags4[SignatureFlags4["IsNonInferrable"] = 64] = "IsNonInferrable";
|
|
3196
|
-
SignatureFlags4[SignatureFlags4["
|
|
3196
|
+
SignatureFlags4[SignatureFlags4["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure";
|
|
3197
|
+
SignatureFlags4[SignatureFlags4["PropagatingFlags"] = 167] = "PropagatingFlags";
|
|
3197
3198
|
SignatureFlags4[SignatureFlags4["CallChainFlags"] = 24] = "CallChainFlags";
|
|
3198
3199
|
return SignatureFlags4;
|
|
3199
3200
|
})(SignatureFlags || {});
|
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-55028-5",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "fb842a7dca335bf33800fb078366120784fc52fa"
|
|
118
118
|
}
|