typescript 4.7.0-dev.20220304 → 4.7.0-dev.20220307
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/cs/diagnosticMessages.generated.json +3 -0
- package/lib/de/diagnosticMessages.generated.json +3 -0
- package/lib/es/diagnosticMessages.generated.json +3 -0
- package/lib/fr/diagnosticMessages.generated.json +3 -0
- package/lib/it/diagnosticMessages.generated.json +3 -0
- package/lib/ja/diagnosticMessages.generated.json +3 -0
- package/lib/ko/diagnosticMessages.generated.json +3 -0
- package/lib/lib.es2020.intl.d.ts +1 -1
- package/lib/pl/diagnosticMessages.generated.json +3 -0
- package/lib/pt-br/diagnosticMessages.generated.json +3 -0
- package/lib/ru/diagnosticMessages.generated.json +3 -0
- package/lib/tr/diagnosticMessages.generated.json +3 -0
- package/lib/tsc.js +123 -31
- package/lib/tsserver.js +128 -34
- package/lib/tsserverlibrary.js +128 -34
- package/lib/typescript.js +128 -34
- package/lib/typescriptServices.js +128 -34
- package/lib/typingsInstaller.js +124 -32
- package/lib/zh-cn/diagnosticMessages.generated.json +3 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +3 -0
- package/package.json +1 -1
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220307";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -39430,7 +39430,8 @@ var ts;
|
|
|
39430
39430
|
name: "jsxFragmentFactory",
|
|
39431
39431
|
type: "string",
|
|
39432
39432
|
category: ts.Diagnostics.Language_and_Environment,
|
|
39433
|
-
description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment
|
|
39433
|
+
description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment,
|
|
39434
|
+
defaultValueDescription: "React.Fragment",
|
|
39434
39435
|
},
|
|
39435
39436
|
{
|
|
39436
39437
|
name: "jsxImportSource",
|
|
@@ -44519,7 +44520,7 @@ var ts;
|
|
|
44519
44520
|
return ts.isDottedName(expr)
|
|
44520
44521
|
|| (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
|
|
44521
44522
|
|| ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
|
|
44522
|
-
|| ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
|
|
44523
|
+
|| ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression)
|
|
44523
44524
|
|| ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
|
|
44524
44525
|
}
|
|
44525
44526
|
function containsNarrowableReference(expr) {
|
|
@@ -52755,7 +52756,15 @@ var ts;
|
|
|
52755
52756
|
});
|
|
52756
52757
|
}
|
|
52757
52758
|
}
|
|
52758
|
-
if (
|
|
52759
|
+
if (symbolName === undefined) {
|
|
52760
|
+
var name = ts.firstDefined(symbol.declarations, ts.getNameOfDeclaration);
|
|
52761
|
+
if (name && ts.isComputedPropertyName(name) && ts.isEntityName(name.expression)) {
|
|
52762
|
+
var LHS = createAccessFromSymbolChain(chain, index - 1, stopper);
|
|
52763
|
+
if (ts.isEntityName(LHS)) {
|
|
52764
|
+
return ts.factory.createIndexedAccessTypeNode(ts.factory.createParenthesizedType(ts.factory.createTypeQueryNode(LHS)), ts.factory.createTypeQueryNode(name.expression));
|
|
52765
|
+
}
|
|
52766
|
+
return LHS;
|
|
52767
|
+
}
|
|
52759
52768
|
symbolName = getNameOfSymbolAsWritten(symbol, context);
|
|
52760
52769
|
}
|
|
52761
52770
|
context.approximateLength += symbolName.length + 1;
|
|
@@ -65495,7 +65504,7 @@ var ts;
|
|
|
65495
65504
|
var requireOptionalProperties = (relation === subtypeRelation || relation === strictSubtypeRelation) && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
|
|
65496
65505
|
var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
|
|
65497
65506
|
if (unmatchedProperty) {
|
|
65498
|
-
if (reportErrors) {
|
|
65507
|
+
if (reportErrors && shouldReportUnmatchedPropertyError(source, target)) {
|
|
65499
65508
|
reportUnmatchedProperty(source, target, unmatchedProperty, requireOptionalProperties);
|
|
65500
65509
|
}
|
|
65501
65510
|
return 0 /* False */;
|
|
@@ -65651,6 +65660,19 @@ var ts;
|
|
|
65651
65660
|
}
|
|
65652
65661
|
return result;
|
|
65653
65662
|
}
|
|
65663
|
+
function shouldReportUnmatchedPropertyError(source, target) {
|
|
65664
|
+
var typeCallSignatures = getSignaturesOfStructuredType(source, 0 /* Call */);
|
|
65665
|
+
var typeConstructSignatures = getSignaturesOfStructuredType(source, 1 /* Construct */);
|
|
65666
|
+
var typeProperties = getPropertiesOfObjectType(source);
|
|
65667
|
+
if ((typeCallSignatures.length || typeConstructSignatures.length) && !typeProperties.length) {
|
|
65668
|
+
if ((getSignaturesOfType(target, 0 /* Call */).length && typeCallSignatures.length) ||
|
|
65669
|
+
(getSignaturesOfType(target, 1 /* Construct */).length && typeConstructSignatures.length)) {
|
|
65670
|
+
return true; // target has similar signature kinds to source, still focus on the unmatched property
|
|
65671
|
+
}
|
|
65672
|
+
return false;
|
|
65673
|
+
}
|
|
65674
|
+
return true;
|
|
65675
|
+
}
|
|
65654
65676
|
function reportIncompatibleCallSignatureReturn(siga, sigb) {
|
|
65655
65677
|
if (siga.parameters.length === 0 && sigb.parameters.length === 0) {
|
|
65656
65678
|
return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); };
|
|
@@ -68226,8 +68248,9 @@ var ts;
|
|
|
68226
68248
|
return isMatchingReference(source.expression, target);
|
|
68227
68249
|
case 205 /* PropertyAccessExpression */:
|
|
68228
68250
|
case 206 /* ElementAccessExpression */:
|
|
68229
|
-
|
|
68230
|
-
|
|
68251
|
+
var sourcePropertyName = getAccessedPropertyName(source);
|
|
68252
|
+
var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined;
|
|
68253
|
+
return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName &&
|
|
68231
68254
|
isMatchingReference(source.expression, target.expression);
|
|
68232
68255
|
case 160 /* QualifiedName */:
|
|
68233
68256
|
return ts.isAccessExpression(target) &&
|
|
@@ -68239,12 +68262,49 @@ var ts;
|
|
|
68239
68262
|
return false;
|
|
68240
68263
|
}
|
|
68241
68264
|
function getAccessedPropertyName(access) {
|
|
68242
|
-
|
|
68243
|
-
|
|
68244
|
-
|
|
68245
|
-
|
|
68246
|
-
|
|
68247
|
-
|
|
68265
|
+
if (ts.isPropertyAccessExpression(access)) {
|
|
68266
|
+
return access.name.escapedText;
|
|
68267
|
+
}
|
|
68268
|
+
if (ts.isElementAccessExpression(access)) {
|
|
68269
|
+
return tryGetElementAccessExpressionName(access);
|
|
68270
|
+
}
|
|
68271
|
+
if (ts.isBindingElement(access)) {
|
|
68272
|
+
var name = getDestructuringPropertyName(access);
|
|
68273
|
+
return name ? ts.escapeLeadingUnderscores(name) : undefined;
|
|
68274
|
+
}
|
|
68275
|
+
if (ts.isParameter(access)) {
|
|
68276
|
+
return ("" + access.parent.parameters.indexOf(access));
|
|
68277
|
+
}
|
|
68278
|
+
return undefined;
|
|
68279
|
+
}
|
|
68280
|
+
function tryGetNameFromType(type) {
|
|
68281
|
+
return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName :
|
|
68282
|
+
type.flags & 384 /* StringOrNumberLiteral */ ? ts.escapeLeadingUnderscores("" + type.value) : undefined;
|
|
68283
|
+
}
|
|
68284
|
+
function tryGetElementAccessExpressionName(node) {
|
|
68285
|
+
if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
|
|
68286
|
+
return ts.escapeLeadingUnderscores(node.argumentExpression.text);
|
|
68287
|
+
}
|
|
68288
|
+
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
68289
|
+
var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
|
|
68290
|
+
if (!symbol || !isConstVariable(symbol))
|
|
68291
|
+
return undefined;
|
|
68292
|
+
var declaration = symbol.valueDeclaration;
|
|
68293
|
+
if (declaration === undefined)
|
|
68294
|
+
return undefined;
|
|
68295
|
+
var type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
68296
|
+
if (type) {
|
|
68297
|
+
var name = tryGetNameFromType(type);
|
|
68298
|
+
if (name !== undefined) {
|
|
68299
|
+
return name;
|
|
68300
|
+
}
|
|
68301
|
+
}
|
|
68302
|
+
if (ts.hasOnlyExpressionInitializer(declaration)) {
|
|
68303
|
+
var initializer = ts.getEffectiveInitializer(declaration);
|
|
68304
|
+
return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
|
|
68305
|
+
}
|
|
68306
|
+
}
|
|
68307
|
+
return undefined;
|
|
68248
68308
|
}
|
|
68249
68309
|
function containsMatchingReference(source, target) {
|
|
68250
68310
|
while (ts.isAccessExpression(source)) {
|
|
@@ -71750,11 +71810,21 @@ var ts;
|
|
|
71750
71810
|
}
|
|
71751
71811
|
return false;
|
|
71752
71812
|
}
|
|
71813
|
+
function uniqueStrings(strings) {
|
|
71814
|
+
var unique = new ts.Set(strings);
|
|
71815
|
+
var result = [];
|
|
71816
|
+
unique.forEach(function (str) { return result.push(str); });
|
|
71817
|
+
return result;
|
|
71818
|
+
}
|
|
71753
71819
|
function discriminateContextualTypeByObjectMembers(node, contextualType) {
|
|
71754
|
-
return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.
|
|
71820
|
+
return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(uniqueStrings(ts.flatMap(contextualType.types, function (memberType) {
|
|
71821
|
+
return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return s.escapedName; });
|
|
71822
|
+
})), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
|
|
71755
71823
|
}
|
|
71756
71824
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
71757
|
-
return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.
|
|
71825
|
+
return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(uniqueStrings(ts.flatMap(contextualType.types, function (memberType) {
|
|
71826
|
+
return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return s.escapedName; });
|
|
71827
|
+
})), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
|
|
71758
71828
|
}
|
|
71759
71829
|
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
|
|
71760
71830
|
// be "pushed" onto a node using the contextualType property.
|
|
@@ -73249,21 +73319,20 @@ var ts;
|
|
|
73249
73319
|
// of the property as base classes
|
|
73250
73320
|
var enclosingClass = forEachEnclosingClass(location, function (enclosingDeclaration) {
|
|
73251
73321
|
var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration));
|
|
73252
|
-
return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing)
|
|
73322
|
+
return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
73253
73323
|
});
|
|
73254
73324
|
// A protected property is accessible if the property is within the declaring class or classes derived from it
|
|
73255
73325
|
if (!enclosingClass) {
|
|
73256
73326
|
// allow PropertyAccessibility if context is in function with this parameter
|
|
73257
|
-
// static member access is
|
|
73258
|
-
|
|
73259
|
-
|
|
73327
|
+
// static member access is disallowed
|
|
73328
|
+
enclosingClass = getEnclosingClassFromThisParameter(location);
|
|
73329
|
+
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
73330
|
+
if (flags & 32 /* Static */ || !enclosingClass) {
|
|
73260
73331
|
if (errorNode) {
|
|
73261
73332
|
error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
|
|
73262
73333
|
}
|
|
73263
73334
|
return false;
|
|
73264
73335
|
}
|
|
73265
|
-
var thisType = getTypeFromTypeNode(thisParameter.type);
|
|
73266
|
-
enclosingClass = ((thisType.flags & 262144 /* TypeParameter */) ? getConstraintOfTypeParameter(thisType) : thisType).target;
|
|
73267
73336
|
}
|
|
73268
73337
|
// No further restrictions for static properties
|
|
73269
73338
|
if (flags & 32 /* Static */) {
|
|
@@ -73281,6 +73350,17 @@ var ts;
|
|
|
73281
73350
|
}
|
|
73282
73351
|
return true;
|
|
73283
73352
|
}
|
|
73353
|
+
function getEnclosingClassFromThisParameter(node) {
|
|
73354
|
+
var thisParameter = getThisParameterFromNodeContext(node);
|
|
73355
|
+
var thisType = (thisParameter === null || thisParameter === void 0 ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
|
|
73356
|
+
if (thisType && thisType.flags & 262144 /* TypeParameter */) {
|
|
73357
|
+
thisType = getConstraintOfTypeParameter(thisType);
|
|
73358
|
+
}
|
|
73359
|
+
if (thisType && ts.getObjectFlags(thisType) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
|
|
73360
|
+
return getTargetType(thisType);
|
|
73361
|
+
}
|
|
73362
|
+
return undefined;
|
|
73363
|
+
}
|
|
73284
73364
|
function getThisParameterFromNodeContext(node) {
|
|
73285
73365
|
var thisContainer = ts.getThisContainer(node, /* includeArrowFunctions */ false);
|
|
73286
73366
|
return thisContainer && ts.isFunctionLike(thisContainer) ? ts.getThisParameter(thisContainer) : undefined;
|
|
@@ -75389,7 +75469,7 @@ var ts;
|
|
|
75389
75469
|
// then it cannot be instantiated.
|
|
75390
75470
|
// In the case of a merged class-module or class-interface declaration,
|
|
75391
75471
|
// only the class declaration node will have the Abstract flag set.
|
|
75392
|
-
if (constructSignatures
|
|
75472
|
+
if (someSignature(constructSignatures, function (signature) { return !!(signature.flags & 4 /* Abstract */); })) {
|
|
75393
75473
|
error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
75394
75474
|
return resolveErrorCall(node);
|
|
75395
75475
|
}
|
|
@@ -75420,6 +75500,12 @@ var ts;
|
|
|
75420
75500
|
invocationError(node.expression, expressionType, 1 /* Construct */);
|
|
75421
75501
|
return resolveErrorCall(node);
|
|
75422
75502
|
}
|
|
75503
|
+
function someSignature(signatures, f) {
|
|
75504
|
+
if (ts.isArray(signatures)) {
|
|
75505
|
+
return ts.some(signatures, function (signature) { return someSignature(signature, f); });
|
|
75506
|
+
}
|
|
75507
|
+
return signatures.compositeKind === 1048576 /* Union */ ? ts.some(signatures.compositeSignatures, f) : f(signatures);
|
|
75508
|
+
}
|
|
75423
75509
|
function typeHasProtectedAccessibleBase(target, type) {
|
|
75424
75510
|
var baseTypes = getBaseTypes(type);
|
|
75425
75511
|
if (!ts.length(baseTypes)) {
|
|
@@ -77262,7 +77348,7 @@ var ts;
|
|
|
77262
77348
|
case 40 /* MinusToken */:
|
|
77263
77349
|
case 54 /* TildeToken */:
|
|
77264
77350
|
checkNonNullType(operandType, node.operand);
|
|
77265
|
-
if (
|
|
77351
|
+
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
|
|
77266
77352
|
error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
|
|
77267
77353
|
}
|
|
77268
77354
|
if (node.operator === 39 /* PlusToken */) {
|
|
@@ -77310,6 +77396,13 @@ var ts;
|
|
|
77310
77396
|
// If it's not a bigint type, implicit coercion will result in a number
|
|
77311
77397
|
return numberType;
|
|
77312
77398
|
}
|
|
77399
|
+
function maybeTypeOfKindConsideringBaseConstraint(type, kind) {
|
|
77400
|
+
if (maybeTypeOfKind(type, kind)) {
|
|
77401
|
+
return true;
|
|
77402
|
+
}
|
|
77403
|
+
var baseConstraint = getBaseConstraintOrType(type);
|
|
77404
|
+
return !!baseConstraint && maybeTypeOfKind(baseConstraint, kind);
|
|
77405
|
+
}
|
|
77313
77406
|
// Return true if type might be of the given kind. A union or intersection type might be of a given
|
|
77314
77407
|
// kind if at least one constituent type is of the given kind.
|
|
77315
77408
|
function maybeTypeOfKind(type, kind) {
|
|
@@ -78019,8 +78112,8 @@ var ts;
|
|
|
78019
78112
|
}
|
|
78020
78113
|
// Return true if there was no error, false if there was an error.
|
|
78021
78114
|
function checkForDisallowedESSymbolOperand(operator) {
|
|
78022
|
-
var offendingSymbolOperand =
|
|
78023
|
-
|
|
78115
|
+
var offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left :
|
|
78116
|
+
maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right :
|
|
78024
78117
|
undefined;
|
|
78025
78118
|
if (offendingSymbolOperand) {
|
|
78026
78119
|
error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));
|
|
@@ -78224,7 +78317,7 @@ var ts;
|
|
|
78224
78317
|
for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
|
|
78225
78318
|
var span = _a[_i];
|
|
78226
78319
|
var type = checkExpression(span.expression);
|
|
78227
|
-
if (
|
|
78320
|
+
if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
|
|
78228
78321
|
error(span.expression, ts.Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
|
|
78229
78322
|
}
|
|
78230
78323
|
texts.push(span.literal.text);
|
|
@@ -83251,7 +83344,7 @@ var ts;
|
|
|
83251
83344
|
}
|
|
83252
83345
|
if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
|
|
83253
83346
|
var propName = member.name;
|
|
83254
|
-
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
|
|
83347
|
+
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
83255
83348
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
83256
83349
|
if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
|
|
83257
83350
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -83286,7 +83379,9 @@ var ts;
|
|
|
83286
83379
|
return false;
|
|
83287
83380
|
}
|
|
83288
83381
|
function isPropertyInitializedInConstructor(propName, propType, constructor) {
|
|
83289
|
-
var reference = ts.
|
|
83382
|
+
var reference = ts.isComputedPropertyName(propName)
|
|
83383
|
+
? ts.factory.createElementAccessExpression(ts.factory.createThis(), propName.expression)
|
|
83384
|
+
: ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
|
|
83290
83385
|
ts.setParent(reference.expression, reference);
|
|
83291
83386
|
ts.setParent(reference, constructor);
|
|
83292
83387
|
reference.flowNode = constructor.returnFlowNode;
|
|
@@ -92843,10 +92938,7 @@ var ts;
|
|
|
92843
92938
|
var substitute = typeof constantValue === "string" ? factory.createStringLiteral(constantValue) : factory.createNumericLiteral(constantValue);
|
|
92844
92939
|
if (!compilerOptions.removeComments) {
|
|
92845
92940
|
var originalNode = ts.getOriginalNode(node, ts.isAccessExpression);
|
|
92846
|
-
|
|
92847
|
-
? ts.declarationNameToString(originalNode.name)
|
|
92848
|
-
: safeMultiLineComment(ts.getTextOfNode(originalNode.argumentExpression));
|
|
92849
|
-
ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + propertyName + " ");
|
|
92941
|
+
ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + safeMultiLineComment(ts.getTextOfNode(originalNode)) + " ");
|
|
92850
92942
|
}
|
|
92851
92943
|
return substitute;
|
|
92852
92944
|
}
|
|
@@ -151464,8 +151556,10 @@ var ts;
|
|
|
151464
151556
|
var checker = program.getTypeChecker();
|
|
151465
151557
|
var compilerOptions = program.getCompilerOptions();
|
|
151466
151558
|
var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions);
|
|
151467
|
-
// "default" is a keyword and not a legal identifier for the import,
|
|
151468
|
-
|
|
151559
|
+
// "default" is a keyword and not a legal identifier for the import, but appears as an identifier.
|
|
151560
|
+
if (symbolName === "default" /* Default */) {
|
|
151561
|
+
return undefined;
|
|
151562
|
+
}
|
|
151469
151563
|
var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
|
|
151470
151564
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
151471
151565
|
var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220307";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -39225,7 +39225,8 @@ var ts;
|
|
|
39225
39225
|
name: "jsxFragmentFactory",
|
|
39226
39226
|
type: "string",
|
|
39227
39227
|
category: ts.Diagnostics.Language_and_Environment,
|
|
39228
|
-
description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment
|
|
39228
|
+
description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment,
|
|
39229
|
+
defaultValueDescription: "React.Fragment",
|
|
39229
39230
|
},
|
|
39230
39231
|
{
|
|
39231
39232
|
name: "jsxImportSource",
|
|
@@ -44314,7 +44315,7 @@ var ts;
|
|
|
44314
44315
|
return ts.isDottedName(expr)
|
|
44315
44316
|
|| (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
|
|
44316
44317
|
|| ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
|
|
44317
|
-
|| ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
|
|
44318
|
+
|| ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression)
|
|
44318
44319
|
|| ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
|
|
44319
44320
|
}
|
|
44320
44321
|
function containsNarrowableReference(expr) {
|
|
@@ -52550,7 +52551,15 @@ var ts;
|
|
|
52550
52551
|
});
|
|
52551
52552
|
}
|
|
52552
52553
|
}
|
|
52553
|
-
if (
|
|
52554
|
+
if (symbolName === undefined) {
|
|
52555
|
+
var name = ts.firstDefined(symbol.declarations, ts.getNameOfDeclaration);
|
|
52556
|
+
if (name && ts.isComputedPropertyName(name) && ts.isEntityName(name.expression)) {
|
|
52557
|
+
var LHS = createAccessFromSymbolChain(chain, index - 1, stopper);
|
|
52558
|
+
if (ts.isEntityName(LHS)) {
|
|
52559
|
+
return ts.factory.createIndexedAccessTypeNode(ts.factory.createParenthesizedType(ts.factory.createTypeQueryNode(LHS)), ts.factory.createTypeQueryNode(name.expression));
|
|
52560
|
+
}
|
|
52561
|
+
return LHS;
|
|
52562
|
+
}
|
|
52554
52563
|
symbolName = getNameOfSymbolAsWritten(symbol, context);
|
|
52555
52564
|
}
|
|
52556
52565
|
context.approximateLength += symbolName.length + 1;
|
|
@@ -65290,7 +65299,7 @@ var ts;
|
|
|
65290
65299
|
var requireOptionalProperties = (relation === subtypeRelation || relation === strictSubtypeRelation) && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
|
|
65291
65300
|
var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
|
|
65292
65301
|
if (unmatchedProperty) {
|
|
65293
|
-
if (reportErrors) {
|
|
65302
|
+
if (reportErrors && shouldReportUnmatchedPropertyError(source, target)) {
|
|
65294
65303
|
reportUnmatchedProperty(source, target, unmatchedProperty, requireOptionalProperties);
|
|
65295
65304
|
}
|
|
65296
65305
|
return 0 /* False */;
|
|
@@ -65446,6 +65455,19 @@ var ts;
|
|
|
65446
65455
|
}
|
|
65447
65456
|
return result;
|
|
65448
65457
|
}
|
|
65458
|
+
function shouldReportUnmatchedPropertyError(source, target) {
|
|
65459
|
+
var typeCallSignatures = getSignaturesOfStructuredType(source, 0 /* Call */);
|
|
65460
|
+
var typeConstructSignatures = getSignaturesOfStructuredType(source, 1 /* Construct */);
|
|
65461
|
+
var typeProperties = getPropertiesOfObjectType(source);
|
|
65462
|
+
if ((typeCallSignatures.length || typeConstructSignatures.length) && !typeProperties.length) {
|
|
65463
|
+
if ((getSignaturesOfType(target, 0 /* Call */).length && typeCallSignatures.length) ||
|
|
65464
|
+
(getSignaturesOfType(target, 1 /* Construct */).length && typeConstructSignatures.length)) {
|
|
65465
|
+
return true; // target has similar signature kinds to source, still focus on the unmatched property
|
|
65466
|
+
}
|
|
65467
|
+
return false;
|
|
65468
|
+
}
|
|
65469
|
+
return true;
|
|
65470
|
+
}
|
|
65449
65471
|
function reportIncompatibleCallSignatureReturn(siga, sigb) {
|
|
65450
65472
|
if (siga.parameters.length === 0 && sigb.parameters.length === 0) {
|
|
65451
65473
|
return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); };
|
|
@@ -68021,8 +68043,9 @@ var ts;
|
|
|
68021
68043
|
return isMatchingReference(source.expression, target);
|
|
68022
68044
|
case 205 /* PropertyAccessExpression */:
|
|
68023
68045
|
case 206 /* ElementAccessExpression */:
|
|
68024
|
-
|
|
68025
|
-
|
|
68046
|
+
var sourcePropertyName = getAccessedPropertyName(source);
|
|
68047
|
+
var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined;
|
|
68048
|
+
return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName &&
|
|
68026
68049
|
isMatchingReference(source.expression, target.expression);
|
|
68027
68050
|
case 160 /* QualifiedName */:
|
|
68028
68051
|
return ts.isAccessExpression(target) &&
|
|
@@ -68034,12 +68057,49 @@ var ts;
|
|
|
68034
68057
|
return false;
|
|
68035
68058
|
}
|
|
68036
68059
|
function getAccessedPropertyName(access) {
|
|
68037
|
-
|
|
68038
|
-
|
|
68039
|
-
|
|
68040
|
-
|
|
68041
|
-
|
|
68042
|
-
|
|
68060
|
+
if (ts.isPropertyAccessExpression(access)) {
|
|
68061
|
+
return access.name.escapedText;
|
|
68062
|
+
}
|
|
68063
|
+
if (ts.isElementAccessExpression(access)) {
|
|
68064
|
+
return tryGetElementAccessExpressionName(access);
|
|
68065
|
+
}
|
|
68066
|
+
if (ts.isBindingElement(access)) {
|
|
68067
|
+
var name = getDestructuringPropertyName(access);
|
|
68068
|
+
return name ? ts.escapeLeadingUnderscores(name) : undefined;
|
|
68069
|
+
}
|
|
68070
|
+
if (ts.isParameter(access)) {
|
|
68071
|
+
return ("" + access.parent.parameters.indexOf(access));
|
|
68072
|
+
}
|
|
68073
|
+
return undefined;
|
|
68074
|
+
}
|
|
68075
|
+
function tryGetNameFromType(type) {
|
|
68076
|
+
return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName :
|
|
68077
|
+
type.flags & 384 /* StringOrNumberLiteral */ ? ts.escapeLeadingUnderscores("" + type.value) : undefined;
|
|
68078
|
+
}
|
|
68079
|
+
function tryGetElementAccessExpressionName(node) {
|
|
68080
|
+
if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
|
|
68081
|
+
return ts.escapeLeadingUnderscores(node.argumentExpression.text);
|
|
68082
|
+
}
|
|
68083
|
+
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
68084
|
+
var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
|
|
68085
|
+
if (!symbol || !isConstVariable(symbol))
|
|
68086
|
+
return undefined;
|
|
68087
|
+
var declaration = symbol.valueDeclaration;
|
|
68088
|
+
if (declaration === undefined)
|
|
68089
|
+
return undefined;
|
|
68090
|
+
var type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
68091
|
+
if (type) {
|
|
68092
|
+
var name = tryGetNameFromType(type);
|
|
68093
|
+
if (name !== undefined) {
|
|
68094
|
+
return name;
|
|
68095
|
+
}
|
|
68096
|
+
}
|
|
68097
|
+
if (ts.hasOnlyExpressionInitializer(declaration)) {
|
|
68098
|
+
var initializer = ts.getEffectiveInitializer(declaration);
|
|
68099
|
+
return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
|
|
68100
|
+
}
|
|
68101
|
+
}
|
|
68102
|
+
return undefined;
|
|
68043
68103
|
}
|
|
68044
68104
|
function containsMatchingReference(source, target) {
|
|
68045
68105
|
while (ts.isAccessExpression(source)) {
|
|
@@ -71545,11 +71605,21 @@ var ts;
|
|
|
71545
71605
|
}
|
|
71546
71606
|
return false;
|
|
71547
71607
|
}
|
|
71608
|
+
function uniqueStrings(strings) {
|
|
71609
|
+
var unique = new ts.Set(strings);
|
|
71610
|
+
var result = [];
|
|
71611
|
+
unique.forEach(function (str) { return result.push(str); });
|
|
71612
|
+
return result;
|
|
71613
|
+
}
|
|
71548
71614
|
function discriminateContextualTypeByObjectMembers(node, contextualType) {
|
|
71549
|
-
return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.
|
|
71615
|
+
return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(uniqueStrings(ts.flatMap(contextualType.types, function (memberType) {
|
|
71616
|
+
return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return s.escapedName; });
|
|
71617
|
+
})), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
|
|
71550
71618
|
}
|
|
71551
71619
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
71552
|
-
return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.
|
|
71620
|
+
return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(uniqueStrings(ts.flatMap(contextualType.types, function (memberType) {
|
|
71621
|
+
return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return s.escapedName; });
|
|
71622
|
+
})), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
|
|
71553
71623
|
}
|
|
71554
71624
|
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
|
|
71555
71625
|
// be "pushed" onto a node using the contextualType property.
|
|
@@ -73044,21 +73114,20 @@ var ts;
|
|
|
73044
73114
|
// of the property as base classes
|
|
73045
73115
|
var enclosingClass = forEachEnclosingClass(location, function (enclosingDeclaration) {
|
|
73046
73116
|
var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration));
|
|
73047
|
-
return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing)
|
|
73117
|
+
return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
73048
73118
|
});
|
|
73049
73119
|
// A protected property is accessible if the property is within the declaring class or classes derived from it
|
|
73050
73120
|
if (!enclosingClass) {
|
|
73051
73121
|
// allow PropertyAccessibility if context is in function with this parameter
|
|
73052
|
-
// static member access is
|
|
73053
|
-
|
|
73054
|
-
|
|
73122
|
+
// static member access is disallowed
|
|
73123
|
+
enclosingClass = getEnclosingClassFromThisParameter(location);
|
|
73124
|
+
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
73125
|
+
if (flags & 32 /* Static */ || !enclosingClass) {
|
|
73055
73126
|
if (errorNode) {
|
|
73056
73127
|
error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
|
|
73057
73128
|
}
|
|
73058
73129
|
return false;
|
|
73059
73130
|
}
|
|
73060
|
-
var thisType = getTypeFromTypeNode(thisParameter.type);
|
|
73061
|
-
enclosingClass = ((thisType.flags & 262144 /* TypeParameter */) ? getConstraintOfTypeParameter(thisType) : thisType).target;
|
|
73062
73131
|
}
|
|
73063
73132
|
// No further restrictions for static properties
|
|
73064
73133
|
if (flags & 32 /* Static */) {
|
|
@@ -73076,6 +73145,17 @@ var ts;
|
|
|
73076
73145
|
}
|
|
73077
73146
|
return true;
|
|
73078
73147
|
}
|
|
73148
|
+
function getEnclosingClassFromThisParameter(node) {
|
|
73149
|
+
var thisParameter = getThisParameterFromNodeContext(node);
|
|
73150
|
+
var thisType = (thisParameter === null || thisParameter === void 0 ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
|
|
73151
|
+
if (thisType && thisType.flags & 262144 /* TypeParameter */) {
|
|
73152
|
+
thisType = getConstraintOfTypeParameter(thisType);
|
|
73153
|
+
}
|
|
73154
|
+
if (thisType && ts.getObjectFlags(thisType) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
|
|
73155
|
+
return getTargetType(thisType);
|
|
73156
|
+
}
|
|
73157
|
+
return undefined;
|
|
73158
|
+
}
|
|
73079
73159
|
function getThisParameterFromNodeContext(node) {
|
|
73080
73160
|
var thisContainer = ts.getThisContainer(node, /* includeArrowFunctions */ false);
|
|
73081
73161
|
return thisContainer && ts.isFunctionLike(thisContainer) ? ts.getThisParameter(thisContainer) : undefined;
|
|
@@ -75184,7 +75264,7 @@ var ts;
|
|
|
75184
75264
|
// then it cannot be instantiated.
|
|
75185
75265
|
// In the case of a merged class-module or class-interface declaration,
|
|
75186
75266
|
// only the class declaration node will have the Abstract flag set.
|
|
75187
|
-
if (constructSignatures
|
|
75267
|
+
if (someSignature(constructSignatures, function (signature) { return !!(signature.flags & 4 /* Abstract */); })) {
|
|
75188
75268
|
error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
75189
75269
|
return resolveErrorCall(node);
|
|
75190
75270
|
}
|
|
@@ -75215,6 +75295,12 @@ var ts;
|
|
|
75215
75295
|
invocationError(node.expression, expressionType, 1 /* Construct */);
|
|
75216
75296
|
return resolveErrorCall(node);
|
|
75217
75297
|
}
|
|
75298
|
+
function someSignature(signatures, f) {
|
|
75299
|
+
if (ts.isArray(signatures)) {
|
|
75300
|
+
return ts.some(signatures, function (signature) { return someSignature(signature, f); });
|
|
75301
|
+
}
|
|
75302
|
+
return signatures.compositeKind === 1048576 /* Union */ ? ts.some(signatures.compositeSignatures, f) : f(signatures);
|
|
75303
|
+
}
|
|
75218
75304
|
function typeHasProtectedAccessibleBase(target, type) {
|
|
75219
75305
|
var baseTypes = getBaseTypes(type);
|
|
75220
75306
|
if (!ts.length(baseTypes)) {
|
|
@@ -77057,7 +77143,7 @@ var ts;
|
|
|
77057
77143
|
case 40 /* MinusToken */:
|
|
77058
77144
|
case 54 /* TildeToken */:
|
|
77059
77145
|
checkNonNullType(operandType, node.operand);
|
|
77060
|
-
if (
|
|
77146
|
+
if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
|
|
77061
77147
|
error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
|
|
77062
77148
|
}
|
|
77063
77149
|
if (node.operator === 39 /* PlusToken */) {
|
|
@@ -77105,6 +77191,13 @@ var ts;
|
|
|
77105
77191
|
// If it's not a bigint type, implicit coercion will result in a number
|
|
77106
77192
|
return numberType;
|
|
77107
77193
|
}
|
|
77194
|
+
function maybeTypeOfKindConsideringBaseConstraint(type, kind) {
|
|
77195
|
+
if (maybeTypeOfKind(type, kind)) {
|
|
77196
|
+
return true;
|
|
77197
|
+
}
|
|
77198
|
+
var baseConstraint = getBaseConstraintOrType(type);
|
|
77199
|
+
return !!baseConstraint && maybeTypeOfKind(baseConstraint, kind);
|
|
77200
|
+
}
|
|
77108
77201
|
// Return true if type might be of the given kind. A union or intersection type might be of a given
|
|
77109
77202
|
// kind if at least one constituent type is of the given kind.
|
|
77110
77203
|
function maybeTypeOfKind(type, kind) {
|
|
@@ -77814,8 +77907,8 @@ var ts;
|
|
|
77814
77907
|
}
|
|
77815
77908
|
// Return true if there was no error, false if there was an error.
|
|
77816
77909
|
function checkForDisallowedESSymbolOperand(operator) {
|
|
77817
|
-
var offendingSymbolOperand =
|
|
77818
|
-
|
|
77910
|
+
var offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left :
|
|
77911
|
+
maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right :
|
|
77819
77912
|
undefined;
|
|
77820
77913
|
if (offendingSymbolOperand) {
|
|
77821
77914
|
error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));
|
|
@@ -78019,7 +78112,7 @@ var ts;
|
|
|
78019
78112
|
for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
|
|
78020
78113
|
var span = _a[_i];
|
|
78021
78114
|
var type = checkExpression(span.expression);
|
|
78022
|
-
if (
|
|
78115
|
+
if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
|
|
78023
78116
|
error(span.expression, ts.Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
|
|
78024
78117
|
}
|
|
78025
78118
|
texts.push(span.literal.text);
|
|
@@ -83046,7 +83139,7 @@ var ts;
|
|
|
83046
83139
|
}
|
|
83047
83140
|
if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
|
|
83048
83141
|
var propName = member.name;
|
|
83049
|
-
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
|
|
83142
|
+
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
83050
83143
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
83051
83144
|
if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
|
|
83052
83145
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -83081,7 +83174,9 @@ var ts;
|
|
|
83081
83174
|
return false;
|
|
83082
83175
|
}
|
|
83083
83176
|
function isPropertyInitializedInConstructor(propName, propType, constructor) {
|
|
83084
|
-
var reference = ts.
|
|
83177
|
+
var reference = ts.isComputedPropertyName(propName)
|
|
83178
|
+
? ts.factory.createElementAccessExpression(ts.factory.createThis(), propName.expression)
|
|
83179
|
+
: ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
|
|
83085
83180
|
ts.setParent(reference.expression, reference);
|
|
83086
83181
|
ts.setParent(reference, constructor);
|
|
83087
83182
|
reference.flowNode = constructor.returnFlowNode;
|
|
@@ -92638,10 +92733,7 @@ var ts;
|
|
|
92638
92733
|
var substitute = typeof constantValue === "string" ? factory.createStringLiteral(constantValue) : factory.createNumericLiteral(constantValue);
|
|
92639
92734
|
if (!compilerOptions.removeComments) {
|
|
92640
92735
|
var originalNode = ts.getOriginalNode(node, ts.isAccessExpression);
|
|
92641
|
-
|
|
92642
|
-
? ts.declarationNameToString(originalNode.name)
|
|
92643
|
-
: safeMultiLineComment(ts.getTextOfNode(originalNode.argumentExpression));
|
|
92644
|
-
ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + propertyName + " ");
|
|
92736
|
+
ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + safeMultiLineComment(ts.getTextOfNode(originalNode)) + " ");
|
|
92645
92737
|
}
|
|
92646
92738
|
return substitute;
|
|
92647
92739
|
}
|