@typescript-deploys/pr-build 5.1.0-pr-51196-8 → 5.1.0-pr-52609-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 +48 -50
- package/lib/tsserver.js +48 -50
- package/lib/tsserverlibrary.js +48 -50
- package/lib/typescript.js +48 -50
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -45969,6 +45969,10 @@ function createTypeChecker(host) {
|
|
|
45969
45969
|
return;
|
|
45970
45970
|
merged.exports.set(name, merged.exports.has(name) ? mergeSymbol(merged.exports.get(name), s) : s);
|
|
45971
45971
|
});
|
|
45972
|
+
if (merged === exported) {
|
|
45973
|
+
getSymbolLinks(merged).resolvedExports = void 0;
|
|
45974
|
+
getSymbolLinks(merged).resolvedMembers = void 0;
|
|
45975
|
+
}
|
|
45972
45976
|
getSymbolLinks(merged).cjsExportMerged = merged;
|
|
45973
45977
|
return links.cjsExportMerged = merged;
|
|
45974
45978
|
}
|
|
@@ -49422,7 +49426,8 @@ function createTypeChecker(host) {
|
|
|
49422
49426
|
), modifierFlags);
|
|
49423
49427
|
}
|
|
49424
49428
|
function getNamespaceMembersForSerialization(symbol) {
|
|
49425
|
-
|
|
49429
|
+
const exports = getExportsOfSymbol(symbol);
|
|
49430
|
+
return !exports ? [] : filter(arrayFrom(exports.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
|
|
49426
49431
|
}
|
|
49427
49432
|
function isTypeOnlyNamespace(symbol) {
|
|
49428
49433
|
return every(getNamespaceMembersForSerialization(symbol), (m) => !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
|
|
@@ -53225,9 +53230,10 @@ function createTypeChecker(host) {
|
|
|
53225
53230
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
53226
53231
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
53227
53232
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
53228
|
-
const
|
|
53229
|
-
const
|
|
53230
|
-
const
|
|
53233
|
+
const mappedType = type.target || type;
|
|
53234
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
53235
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
53236
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
53231
53237
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
53232
53238
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
53233
53239
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -53264,7 +53270,7 @@ function createTypeChecker(host) {
|
|
|
53264
53270
|
prop.links.keyType = keyType;
|
|
53265
53271
|
if (modifiersProp) {
|
|
53266
53272
|
prop.links.syntheticOrigin = modifiersProp;
|
|
53267
|
-
prop.declarations =
|
|
53273
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
53268
53274
|
}
|
|
53269
53275
|
members.set(propName, prop);
|
|
53270
53276
|
}
|
|
@@ -53370,6 +53376,10 @@ function createTypeChecker(host) {
|
|
|
53370
53376
|
}
|
|
53371
53377
|
return false;
|
|
53372
53378
|
}
|
|
53379
|
+
function isFilteringMappedType(type) {
|
|
53380
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
53381
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
53382
|
+
}
|
|
53373
53383
|
function resolveStructuredTypeMembers(type) {
|
|
53374
53384
|
if (!type.members) {
|
|
53375
53385
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -53729,7 +53739,7 @@ function createTypeChecker(host) {
|
|
|
53729
53739
|
const typeVariable = getHomomorphicTypeVariable(type);
|
|
53730
53740
|
if (typeVariable && !type.declaration.nameType) {
|
|
53731
53741
|
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
53732
|
-
if (constraint &&
|
|
53742
|
+
if (constraint && isArrayType(constraint)) {
|
|
53733
53743
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
53734
53744
|
}
|
|
53735
53745
|
}
|
|
@@ -56909,8 +56919,7 @@ function createTypeChecker(host) {
|
|
|
56909
56919
|
}
|
|
56910
56920
|
}
|
|
56911
56921
|
if (isGenericMappedType(objectType)) {
|
|
56912
|
-
|
|
56913
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
56922
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
56914
56923
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
56915
56924
|
}
|
|
56916
56925
|
}
|
|
@@ -66397,21 +66406,7 @@ function createTypeChecker(host) {
|
|
|
66397
66406
|
}
|
|
66398
66407
|
const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
|
|
66399
66408
|
if (signature && !isResolvingReturnTypeOfSignature(signature)) {
|
|
66400
|
-
|
|
66401
|
-
return filterType(getReturnTypeOfSignature(signature), (returnType2) => {
|
|
66402
|
-
if (functionFlags & 1 /* Generator */) {
|
|
66403
|
-
return checkGeneratorInstantiationAssignabilityToReturnType(
|
|
66404
|
-
returnType2,
|
|
66405
|
-
functionFlags,
|
|
66406
|
-
/*errorNode*/
|
|
66407
|
-
void 0
|
|
66408
|
-
);
|
|
66409
|
-
}
|
|
66410
|
-
if (functionFlags & 2 /* Async */) {
|
|
66411
|
-
return !!getAwaitedTypeOfPromise(returnType2);
|
|
66412
|
-
}
|
|
66413
|
-
return true;
|
|
66414
|
-
});
|
|
66409
|
+
return getReturnTypeOfSignature(signature);
|
|
66415
66410
|
}
|
|
66416
66411
|
const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
66417
66412
|
if (iife) {
|
|
@@ -67669,7 +67664,7 @@ function createTypeChecker(host) {
|
|
|
67669
67664
|
}
|
|
67670
67665
|
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
67671
67666
|
const attributes = openingLikeElement.attributes;
|
|
67672
|
-
const
|
|
67667
|
+
const contextualType = getContextualType(attributes, 0 /* None */);
|
|
67673
67668
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
67674
67669
|
let attributesTable = createSymbolTable();
|
|
67675
67670
|
let spread = emptyJsxObjectType;
|
|
@@ -67696,12 +67691,18 @@ function createTypeChecker(host) {
|
|
|
67696
67691
|
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
|
|
67697
67692
|
explicitlySpecifyChildrenAttribute = true;
|
|
67698
67693
|
}
|
|
67699
|
-
if (
|
|
67700
|
-
const prop = getPropertyOfType(
|
|
67694
|
+
if (contextualType) {
|
|
67695
|
+
const prop = getPropertyOfType(contextualType, member.escapedName);
|
|
67701
67696
|
if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
|
|
67702
67697
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
67703
67698
|
}
|
|
67704
67699
|
}
|
|
67700
|
+
if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
67701
|
+
const inferenceContext = getInferenceContext(attributes);
|
|
67702
|
+
Debug.assert(inferenceContext);
|
|
67703
|
+
const inferenceNode = attributeDecl.initializer.expression;
|
|
67704
|
+
addIntraExpressionInferenceSite(inferenceContext, inferenceNode, exprType);
|
|
67705
|
+
}
|
|
67705
67706
|
} else {
|
|
67706
67707
|
Debug.assert(attributeDecl.kind === 291 /* JsxSpreadAttribute */);
|
|
67707
67708
|
if (attributesTable.size > 0) {
|
|
@@ -67756,12 +67757,12 @@ function createTypeChecker(host) {
|
|
|
67756
67757
|
if (explicitlySpecifyChildrenAttribute) {
|
|
67757
67758
|
error(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
67758
67759
|
}
|
|
67759
|
-
const
|
|
67760
|
+
const contextualType2 = getApparentTypeOfContextualType(
|
|
67760
67761
|
openingLikeElement.attributes,
|
|
67761
67762
|
/*contextFlags*/
|
|
67762
67763
|
void 0
|
|
67763
67764
|
);
|
|
67764
|
-
const childrenContextualType =
|
|
67765
|
+
const childrenContextualType = contextualType2 && getTypeOfPropertyOfContextualType(contextualType2, jsxChildrenPropertyName);
|
|
67765
67766
|
const childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
67766
67767
|
childrenPropSymbol.links.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
|
|
67767
67768
|
childrenPropSymbol.valueDeclaration = factory.createPropertySignature(
|
|
@@ -72194,6 +72195,11 @@ function createTypeChecker(host) {
|
|
|
72194
72195
|
} else {
|
|
72195
72196
|
assignNonContextualParameterTypes(signature);
|
|
72196
72197
|
}
|
|
72198
|
+
} else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
|
72199
|
+
const inferenceContext = getInferenceContext(node);
|
|
72200
|
+
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
72201
|
+
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
72202
|
+
}
|
|
72197
72203
|
}
|
|
72198
72204
|
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
|
72199
72205
|
const returnType = getReturnTypeFromBody(node, checkMode);
|
|
@@ -73383,15 +73389,7 @@ function createTypeChecker(host) {
|
|
|
73383
73389
|
checkExternalEmitHelpers(node, 256 /* Values */);
|
|
73384
73390
|
}
|
|
73385
73391
|
}
|
|
73386
|
-
|
|
73387
|
-
if (returnType && returnType.flags & 1048576 /* Union */) {
|
|
73388
|
-
returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
|
|
73389
|
-
t,
|
|
73390
|
-
functionFlags,
|
|
73391
|
-
/*errorNode*/
|
|
73392
|
-
void 0
|
|
73393
|
-
));
|
|
73394
|
-
}
|
|
73392
|
+
const returnType = getReturnTypeFromAnnotation(func);
|
|
73395
73393
|
const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
|
|
73396
73394
|
const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
|
|
73397
73395
|
const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
|
|
@@ -74193,7 +74191,11 @@ function createTypeChecker(host) {
|
|
|
74193
74191
|
if (returnType === voidType) {
|
|
74194
74192
|
error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
74195
74193
|
} else {
|
|
74196
|
-
|
|
74194
|
+
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
|
|
74195
|
+
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
74196
|
+
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
|
|
74197
|
+
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
|
|
74198
|
+
checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
|
|
74197
74199
|
}
|
|
74198
74200
|
} else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
74199
74201
|
checkAsyncFunctionReturnType(node, returnTypeNode);
|
|
@@ -74204,13 +74206,6 @@ function createTypeChecker(host) {
|
|
|
74204
74206
|
}
|
|
74205
74207
|
}
|
|
74206
74208
|
}
|
|
74207
|
-
function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
|
|
74208
|
-
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
74209
|
-
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
74210
|
-
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
74211
|
-
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
74212
|
-
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
74213
|
-
}
|
|
74214
74209
|
function checkClassForDuplicateDeclarations(node) {
|
|
74215
74210
|
const instanceNames = /* @__PURE__ */ new Map();
|
|
74216
74211
|
const staticNames = /* @__PURE__ */ new Map();
|
|
@@ -103957,7 +103952,7 @@ function transformNodeModule(context) {
|
|
|
103957
103952
|
|
|
103958
103953
|
// src/compiler/transformers/declarations/diagnostics.ts
|
|
103959
103954
|
function canProduceDiagnostics(node) {
|
|
103960
|
-
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isJSDocTypeAlias(node);
|
|
103955
|
+
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isJSDocTypeAlias(node);
|
|
103961
103956
|
}
|
|
103962
103957
|
function createGetSymbolAccessibilityDiagnosticForNodeName(node) {
|
|
103963
103958
|
if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
@@ -104003,7 +103998,7 @@ function createGetSymbolAccessibilityDiagnosticForNodeName(node) {
|
|
|
104003
103998
|
}
|
|
104004
103999
|
}
|
|
104005
104000
|
function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
104006
|
-
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
104001
|
+
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
104007
104002
|
return getVariableDeclarationTypeVisibilityError;
|
|
104008
104003
|
} else if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
104009
104004
|
return getAccessorDeclarationTypeVisibilityError;
|
|
@@ -104028,7 +104023,7 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
104028
104023
|
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
|
|
104029
104024
|
if (node.kind === 258 /* VariableDeclaration */ || node.kind === 206 /* BindingElement */) {
|
|
104030
104025
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
|
104031
|
-
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
104026
|
+
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 210 /* ElementAccessExpression */ || node.kind === 224 /* BinaryExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
104032
104027
|
if (isStatic(node)) {
|
|
104033
104028
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
|
104034
104029
|
} else if (node.parent.kind === 261 /* ClassDeclaration */ || node.kind === 167 /* Parameter */) {
|
|
@@ -105481,13 +105476,16 @@ function transformDeclarations(context) {
|
|
|
105481
105476
|
fakespace.symbol = props[0].parent;
|
|
105482
105477
|
const exportMappings = [];
|
|
105483
105478
|
let declarations = mapDefined(props, (p) => {
|
|
105484
|
-
if (!p.valueDeclaration || !isPropertyAccessExpression(p.valueDeclaration)) {
|
|
105479
|
+
if (!p.valueDeclaration || !(isPropertyAccessExpression(p.valueDeclaration) || isElementAccessExpression(p.valueDeclaration) || isBinaryExpression(p.valueDeclaration))) {
|
|
105480
|
+
return void 0;
|
|
105481
|
+
}
|
|
105482
|
+
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
105483
|
+
if (!isIdentifierText(nameStr, 99 /* ESNext */)) {
|
|
105485
105484
|
return void 0;
|
|
105486
105485
|
}
|
|
105487
105486
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
105488
105487
|
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
105489
105488
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
105490
|
-
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
105491
105489
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
105492
105490
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
105493
105491
|
if (isNonContextualKeywordName) {
|
package/lib/tsserver.js
CHANGED
|
@@ -50566,6 +50566,10 @@ function createTypeChecker(host) {
|
|
|
50566
50566
|
return;
|
|
50567
50567
|
merged.exports.set(name, merged.exports.has(name) ? mergeSymbol(merged.exports.get(name), s) : s);
|
|
50568
50568
|
});
|
|
50569
|
+
if (merged === exported) {
|
|
50570
|
+
getSymbolLinks(merged).resolvedExports = void 0;
|
|
50571
|
+
getSymbolLinks(merged).resolvedMembers = void 0;
|
|
50572
|
+
}
|
|
50569
50573
|
getSymbolLinks(merged).cjsExportMerged = merged;
|
|
50570
50574
|
return links.cjsExportMerged = merged;
|
|
50571
50575
|
}
|
|
@@ -54019,7 +54023,8 @@ function createTypeChecker(host) {
|
|
|
54019
54023
|
), modifierFlags);
|
|
54020
54024
|
}
|
|
54021
54025
|
function getNamespaceMembersForSerialization(symbol) {
|
|
54022
|
-
|
|
54026
|
+
const exports = getExportsOfSymbol(symbol);
|
|
54027
|
+
return !exports ? [] : filter(arrayFrom(exports.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
|
|
54023
54028
|
}
|
|
54024
54029
|
function isTypeOnlyNamespace(symbol) {
|
|
54025
54030
|
return every(getNamespaceMembersForSerialization(symbol), (m) => !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
|
|
@@ -57822,9 +57827,10 @@ function createTypeChecker(host) {
|
|
|
57822
57827
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
57823
57828
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
57824
57829
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
57825
|
-
const
|
|
57826
|
-
const
|
|
57827
|
-
const
|
|
57830
|
+
const mappedType = type.target || type;
|
|
57831
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
57832
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
57833
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
57828
57834
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
57829
57835
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
57830
57836
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -57861,7 +57867,7 @@ function createTypeChecker(host) {
|
|
|
57861
57867
|
prop.links.keyType = keyType;
|
|
57862
57868
|
if (modifiersProp) {
|
|
57863
57869
|
prop.links.syntheticOrigin = modifiersProp;
|
|
57864
|
-
prop.declarations =
|
|
57870
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
57865
57871
|
}
|
|
57866
57872
|
members.set(propName, prop);
|
|
57867
57873
|
}
|
|
@@ -57967,6 +57973,10 @@ function createTypeChecker(host) {
|
|
|
57967
57973
|
}
|
|
57968
57974
|
return false;
|
|
57969
57975
|
}
|
|
57976
|
+
function isFilteringMappedType(type) {
|
|
57977
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
57978
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
57979
|
+
}
|
|
57970
57980
|
function resolveStructuredTypeMembers(type) {
|
|
57971
57981
|
if (!type.members) {
|
|
57972
57982
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -58326,7 +58336,7 @@ function createTypeChecker(host) {
|
|
|
58326
58336
|
const typeVariable = getHomomorphicTypeVariable(type);
|
|
58327
58337
|
if (typeVariable && !type.declaration.nameType) {
|
|
58328
58338
|
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
58329
|
-
if (constraint &&
|
|
58339
|
+
if (constraint && isArrayType(constraint)) {
|
|
58330
58340
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
58331
58341
|
}
|
|
58332
58342
|
}
|
|
@@ -61506,8 +61516,7 @@ function createTypeChecker(host) {
|
|
|
61506
61516
|
}
|
|
61507
61517
|
}
|
|
61508
61518
|
if (isGenericMappedType(objectType)) {
|
|
61509
|
-
|
|
61510
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
61519
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
61511
61520
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
61512
61521
|
}
|
|
61513
61522
|
}
|
|
@@ -70994,21 +71003,7 @@ function createTypeChecker(host) {
|
|
|
70994
71003
|
}
|
|
70995
71004
|
const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
|
|
70996
71005
|
if (signature && !isResolvingReturnTypeOfSignature(signature)) {
|
|
70997
|
-
|
|
70998
|
-
return filterType(getReturnTypeOfSignature(signature), (returnType2) => {
|
|
70999
|
-
if (functionFlags & 1 /* Generator */) {
|
|
71000
|
-
return checkGeneratorInstantiationAssignabilityToReturnType(
|
|
71001
|
-
returnType2,
|
|
71002
|
-
functionFlags,
|
|
71003
|
-
/*errorNode*/
|
|
71004
|
-
void 0
|
|
71005
|
-
);
|
|
71006
|
-
}
|
|
71007
|
-
if (functionFlags & 2 /* Async */) {
|
|
71008
|
-
return !!getAwaitedTypeOfPromise(returnType2);
|
|
71009
|
-
}
|
|
71010
|
-
return true;
|
|
71011
|
-
});
|
|
71006
|
+
return getReturnTypeOfSignature(signature);
|
|
71012
71007
|
}
|
|
71013
71008
|
const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
71014
71009
|
if (iife) {
|
|
@@ -72266,7 +72261,7 @@ function createTypeChecker(host) {
|
|
|
72266
72261
|
}
|
|
72267
72262
|
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
72268
72263
|
const attributes = openingLikeElement.attributes;
|
|
72269
|
-
const
|
|
72264
|
+
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
72270
72265
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
72271
72266
|
let attributesTable = createSymbolTable();
|
|
72272
72267
|
let spread = emptyJsxObjectType;
|
|
@@ -72293,12 +72288,18 @@ function createTypeChecker(host) {
|
|
|
72293
72288
|
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
|
|
72294
72289
|
explicitlySpecifyChildrenAttribute = true;
|
|
72295
72290
|
}
|
|
72296
|
-
if (
|
|
72297
|
-
const prop = getPropertyOfType(
|
|
72291
|
+
if (contextualType) {
|
|
72292
|
+
const prop = getPropertyOfType(contextualType, member.escapedName);
|
|
72298
72293
|
if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
|
|
72299
72294
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
72300
72295
|
}
|
|
72301
72296
|
}
|
|
72297
|
+
if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
72298
|
+
const inferenceContext = getInferenceContext(attributes);
|
|
72299
|
+
Debug.assert(inferenceContext);
|
|
72300
|
+
const inferenceNode = attributeDecl.initializer.expression;
|
|
72301
|
+
addIntraExpressionInferenceSite(inferenceContext, inferenceNode, exprType);
|
|
72302
|
+
}
|
|
72302
72303
|
} else {
|
|
72303
72304
|
Debug.assert(attributeDecl.kind === 291 /* JsxSpreadAttribute */);
|
|
72304
72305
|
if (attributesTable.size > 0) {
|
|
@@ -72353,12 +72354,12 @@ function createTypeChecker(host) {
|
|
|
72353
72354
|
if (explicitlySpecifyChildrenAttribute) {
|
|
72354
72355
|
error(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
72355
72356
|
}
|
|
72356
|
-
const
|
|
72357
|
+
const contextualType2 = getApparentTypeOfContextualType(
|
|
72357
72358
|
openingLikeElement.attributes,
|
|
72358
72359
|
/*contextFlags*/
|
|
72359
72360
|
void 0
|
|
72360
72361
|
);
|
|
72361
|
-
const childrenContextualType =
|
|
72362
|
+
const childrenContextualType = contextualType2 && getTypeOfPropertyOfContextualType(contextualType2, jsxChildrenPropertyName);
|
|
72362
72363
|
const childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
72363
72364
|
childrenPropSymbol.links.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
|
|
72364
72365
|
childrenPropSymbol.valueDeclaration = factory.createPropertySignature(
|
|
@@ -76791,6 +76792,11 @@ function createTypeChecker(host) {
|
|
|
76791
76792
|
} else {
|
|
76792
76793
|
assignNonContextualParameterTypes(signature);
|
|
76793
76794
|
}
|
|
76795
|
+
} else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
|
76796
|
+
const inferenceContext = getInferenceContext(node);
|
|
76797
|
+
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
76798
|
+
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
76799
|
+
}
|
|
76794
76800
|
}
|
|
76795
76801
|
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
|
76796
76802
|
const returnType = getReturnTypeFromBody(node, checkMode);
|
|
@@ -77980,15 +77986,7 @@ function createTypeChecker(host) {
|
|
|
77980
77986
|
checkExternalEmitHelpers(node, 256 /* Values */);
|
|
77981
77987
|
}
|
|
77982
77988
|
}
|
|
77983
|
-
|
|
77984
|
-
if (returnType && returnType.flags & 1048576 /* Union */) {
|
|
77985
|
-
returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
|
|
77986
|
-
t,
|
|
77987
|
-
functionFlags,
|
|
77988
|
-
/*errorNode*/
|
|
77989
|
-
void 0
|
|
77990
|
-
));
|
|
77991
|
-
}
|
|
77989
|
+
const returnType = getReturnTypeFromAnnotation(func);
|
|
77992
77990
|
const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
|
|
77993
77991
|
const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
|
|
77994
77992
|
const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
|
|
@@ -78790,7 +78788,11 @@ function createTypeChecker(host) {
|
|
|
78790
78788
|
if (returnType === voidType) {
|
|
78791
78789
|
error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
78792
78790
|
} else {
|
|
78793
|
-
|
|
78791
|
+
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
|
|
78792
|
+
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
78793
|
+
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
|
|
78794
|
+
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
|
|
78795
|
+
checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
|
|
78794
78796
|
}
|
|
78795
78797
|
} else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
78796
78798
|
checkAsyncFunctionReturnType(node, returnTypeNode);
|
|
@@ -78801,13 +78803,6 @@ function createTypeChecker(host) {
|
|
|
78801
78803
|
}
|
|
78802
78804
|
}
|
|
78803
78805
|
}
|
|
78804
|
-
function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
|
|
78805
|
-
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
78806
|
-
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
78807
|
-
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
78808
|
-
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
78809
|
-
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
78810
|
-
}
|
|
78811
78806
|
function checkClassForDuplicateDeclarations(node) {
|
|
78812
78807
|
const instanceNames = /* @__PURE__ */ new Map();
|
|
78813
78808
|
const staticNames = /* @__PURE__ */ new Map();
|
|
@@ -108725,7 +108720,7 @@ function transformNodeModule(context) {
|
|
|
108725
108720
|
|
|
108726
108721
|
// src/compiler/transformers/declarations/diagnostics.ts
|
|
108727
108722
|
function canProduceDiagnostics(node) {
|
|
108728
|
-
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isJSDocTypeAlias(node);
|
|
108723
|
+
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isJSDocTypeAlias(node);
|
|
108729
108724
|
}
|
|
108730
108725
|
function createGetSymbolAccessibilityDiagnosticForNodeName(node) {
|
|
108731
108726
|
if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
@@ -108771,7 +108766,7 @@ function createGetSymbolAccessibilityDiagnosticForNodeName(node) {
|
|
|
108771
108766
|
}
|
|
108772
108767
|
}
|
|
108773
108768
|
function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
108774
|
-
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
108769
|
+
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
108775
108770
|
return getVariableDeclarationTypeVisibilityError;
|
|
108776
108771
|
} else if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
108777
108772
|
return getAccessorDeclarationTypeVisibilityError;
|
|
@@ -108796,7 +108791,7 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
108796
108791
|
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
|
|
108797
108792
|
if (node.kind === 258 /* VariableDeclaration */ || node.kind === 206 /* BindingElement */) {
|
|
108798
108793
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
|
108799
|
-
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
108794
|
+
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 210 /* ElementAccessExpression */ || node.kind === 224 /* BinaryExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
108800
108795
|
if (isStatic(node)) {
|
|
108801
108796
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
|
108802
108797
|
} else if (node.parent.kind === 261 /* ClassDeclaration */ || node.kind === 167 /* Parameter */) {
|
|
@@ -110249,13 +110244,16 @@ function transformDeclarations(context) {
|
|
|
110249
110244
|
fakespace.symbol = props[0].parent;
|
|
110250
110245
|
const exportMappings = [];
|
|
110251
110246
|
let declarations = mapDefined(props, (p) => {
|
|
110252
|
-
if (!p.valueDeclaration || !isPropertyAccessExpression(p.valueDeclaration)) {
|
|
110247
|
+
if (!p.valueDeclaration || !(isPropertyAccessExpression(p.valueDeclaration) || isElementAccessExpression(p.valueDeclaration) || isBinaryExpression(p.valueDeclaration))) {
|
|
110248
|
+
return void 0;
|
|
110249
|
+
}
|
|
110250
|
+
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
110251
|
+
if (!isIdentifierText(nameStr, 99 /* ESNext */)) {
|
|
110253
110252
|
return void 0;
|
|
110254
110253
|
}
|
|
110255
110254
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
110256
110255
|
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
110257
110256
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
110258
|
-
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
110259
110257
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
110260
110258
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
110261
110259
|
if (isNonContextualKeywordName) {
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -48377,6 +48377,10 @@ ${lanes.join("\n")}
|
|
|
48377
48377
|
return;
|
|
48378
48378
|
merged.exports.set(name, merged.exports.has(name) ? mergeSymbol(merged.exports.get(name), s) : s);
|
|
48379
48379
|
});
|
|
48380
|
+
if (merged === exported) {
|
|
48381
|
+
getSymbolLinks(merged).resolvedExports = void 0;
|
|
48382
|
+
getSymbolLinks(merged).resolvedMembers = void 0;
|
|
48383
|
+
}
|
|
48380
48384
|
getSymbolLinks(merged).cjsExportMerged = merged;
|
|
48381
48385
|
return links.cjsExportMerged = merged;
|
|
48382
48386
|
}
|
|
@@ -51830,7 +51834,8 @@ ${lanes.join("\n")}
|
|
|
51830
51834
|
), modifierFlags);
|
|
51831
51835
|
}
|
|
51832
51836
|
function getNamespaceMembersForSerialization(symbol) {
|
|
51833
|
-
|
|
51837
|
+
const exports = getExportsOfSymbol(symbol);
|
|
51838
|
+
return !exports ? [] : filter(arrayFrom(exports.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
|
|
51834
51839
|
}
|
|
51835
51840
|
function isTypeOnlyNamespace(symbol) {
|
|
51836
51841
|
return every(getNamespaceMembersForSerialization(symbol), (m) => !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
|
|
@@ -55633,9 +55638,10 @@ ${lanes.join("\n")}
|
|
|
55633
55638
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
55634
55639
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
55635
55640
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
55636
|
-
const
|
|
55637
|
-
const
|
|
55638
|
-
const
|
|
55641
|
+
const mappedType = type.target || type;
|
|
55642
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
55643
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
55644
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
55639
55645
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
55640
55646
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
55641
55647
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -55672,7 +55678,7 @@ ${lanes.join("\n")}
|
|
|
55672
55678
|
prop.links.keyType = keyType;
|
|
55673
55679
|
if (modifiersProp) {
|
|
55674
55680
|
prop.links.syntheticOrigin = modifiersProp;
|
|
55675
|
-
prop.declarations =
|
|
55681
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
55676
55682
|
}
|
|
55677
55683
|
members.set(propName, prop);
|
|
55678
55684
|
}
|
|
@@ -55778,6 +55784,10 @@ ${lanes.join("\n")}
|
|
|
55778
55784
|
}
|
|
55779
55785
|
return false;
|
|
55780
55786
|
}
|
|
55787
|
+
function isFilteringMappedType(type) {
|
|
55788
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
55789
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
55790
|
+
}
|
|
55781
55791
|
function resolveStructuredTypeMembers(type) {
|
|
55782
55792
|
if (!type.members) {
|
|
55783
55793
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -56137,7 +56147,7 @@ ${lanes.join("\n")}
|
|
|
56137
56147
|
const typeVariable = getHomomorphicTypeVariable(type);
|
|
56138
56148
|
if (typeVariable && !type.declaration.nameType) {
|
|
56139
56149
|
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
56140
|
-
if (constraint &&
|
|
56150
|
+
if (constraint && isArrayType(constraint)) {
|
|
56141
56151
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
56142
56152
|
}
|
|
56143
56153
|
}
|
|
@@ -59317,8 +59327,7 @@ ${lanes.join("\n")}
|
|
|
59317
59327
|
}
|
|
59318
59328
|
}
|
|
59319
59329
|
if (isGenericMappedType(objectType)) {
|
|
59320
|
-
|
|
59321
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
59330
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
59322
59331
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
59323
59332
|
}
|
|
59324
59333
|
}
|
|
@@ -68805,21 +68814,7 @@ ${lanes.join("\n")}
|
|
|
68805
68814
|
}
|
|
68806
68815
|
const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
|
|
68807
68816
|
if (signature && !isResolvingReturnTypeOfSignature(signature)) {
|
|
68808
|
-
|
|
68809
|
-
return filterType(getReturnTypeOfSignature(signature), (returnType2) => {
|
|
68810
|
-
if (functionFlags & 1 /* Generator */) {
|
|
68811
|
-
return checkGeneratorInstantiationAssignabilityToReturnType(
|
|
68812
|
-
returnType2,
|
|
68813
|
-
functionFlags,
|
|
68814
|
-
/*errorNode*/
|
|
68815
|
-
void 0
|
|
68816
|
-
);
|
|
68817
|
-
}
|
|
68818
|
-
if (functionFlags & 2 /* Async */) {
|
|
68819
|
-
return !!getAwaitedTypeOfPromise(returnType2);
|
|
68820
|
-
}
|
|
68821
|
-
return true;
|
|
68822
|
-
});
|
|
68817
|
+
return getReturnTypeOfSignature(signature);
|
|
68823
68818
|
}
|
|
68824
68819
|
const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
68825
68820
|
if (iife) {
|
|
@@ -70077,7 +70072,7 @@ ${lanes.join("\n")}
|
|
|
70077
70072
|
}
|
|
70078
70073
|
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
70079
70074
|
const attributes = openingLikeElement.attributes;
|
|
70080
|
-
const
|
|
70075
|
+
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
70081
70076
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
70082
70077
|
let attributesTable = createSymbolTable();
|
|
70083
70078
|
let spread = emptyJsxObjectType;
|
|
@@ -70104,12 +70099,18 @@ ${lanes.join("\n")}
|
|
|
70104
70099
|
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
|
|
70105
70100
|
explicitlySpecifyChildrenAttribute = true;
|
|
70106
70101
|
}
|
|
70107
|
-
if (
|
|
70108
|
-
const prop = getPropertyOfType(
|
|
70102
|
+
if (contextualType) {
|
|
70103
|
+
const prop = getPropertyOfType(contextualType, member.escapedName);
|
|
70109
70104
|
if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
|
|
70110
70105
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
70111
70106
|
}
|
|
70112
70107
|
}
|
|
70108
|
+
if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
70109
|
+
const inferenceContext = getInferenceContext(attributes);
|
|
70110
|
+
Debug.assert(inferenceContext);
|
|
70111
|
+
const inferenceNode = attributeDecl.initializer.expression;
|
|
70112
|
+
addIntraExpressionInferenceSite(inferenceContext, inferenceNode, exprType);
|
|
70113
|
+
}
|
|
70113
70114
|
} else {
|
|
70114
70115
|
Debug.assert(attributeDecl.kind === 291 /* JsxSpreadAttribute */);
|
|
70115
70116
|
if (attributesTable.size > 0) {
|
|
@@ -70164,12 +70165,12 @@ ${lanes.join("\n")}
|
|
|
70164
70165
|
if (explicitlySpecifyChildrenAttribute) {
|
|
70165
70166
|
error(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
70166
70167
|
}
|
|
70167
|
-
const
|
|
70168
|
+
const contextualType2 = getApparentTypeOfContextualType(
|
|
70168
70169
|
openingLikeElement.attributes,
|
|
70169
70170
|
/*contextFlags*/
|
|
70170
70171
|
void 0
|
|
70171
70172
|
);
|
|
70172
|
-
const childrenContextualType =
|
|
70173
|
+
const childrenContextualType = contextualType2 && getTypeOfPropertyOfContextualType(contextualType2, jsxChildrenPropertyName);
|
|
70173
70174
|
const childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
70174
70175
|
childrenPropSymbol.links.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
|
|
70175
70176
|
childrenPropSymbol.valueDeclaration = factory.createPropertySignature(
|
|
@@ -74602,6 +74603,11 @@ ${lanes.join("\n")}
|
|
|
74602
74603
|
} else {
|
|
74603
74604
|
assignNonContextualParameterTypes(signature);
|
|
74604
74605
|
}
|
|
74606
|
+
} else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
|
74607
|
+
const inferenceContext = getInferenceContext(node);
|
|
74608
|
+
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
74609
|
+
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
74610
|
+
}
|
|
74605
74611
|
}
|
|
74606
74612
|
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
|
74607
74613
|
const returnType = getReturnTypeFromBody(node, checkMode);
|
|
@@ -75791,15 +75797,7 @@ ${lanes.join("\n")}
|
|
|
75791
75797
|
checkExternalEmitHelpers(node, 256 /* Values */);
|
|
75792
75798
|
}
|
|
75793
75799
|
}
|
|
75794
|
-
|
|
75795
|
-
if (returnType && returnType.flags & 1048576 /* Union */) {
|
|
75796
|
-
returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
|
|
75797
|
-
t,
|
|
75798
|
-
functionFlags,
|
|
75799
|
-
/*errorNode*/
|
|
75800
|
-
void 0
|
|
75801
|
-
));
|
|
75802
|
-
}
|
|
75800
|
+
const returnType = getReturnTypeFromAnnotation(func);
|
|
75803
75801
|
const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
|
|
75804
75802
|
const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
|
|
75805
75803
|
const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
|
|
@@ -76601,7 +76599,11 @@ ${lanes.join("\n")}
|
|
|
76601
76599
|
if (returnType === voidType) {
|
|
76602
76600
|
error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
76603
76601
|
} else {
|
|
76604
|
-
|
|
76602
|
+
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
|
|
76603
|
+
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
76604
|
+
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
|
|
76605
|
+
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
|
|
76606
|
+
checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
|
|
76605
76607
|
}
|
|
76606
76608
|
} else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
76607
76609
|
checkAsyncFunctionReturnType(node, returnTypeNode);
|
|
@@ -76612,13 +76614,6 @@ ${lanes.join("\n")}
|
|
|
76612
76614
|
}
|
|
76613
76615
|
}
|
|
76614
76616
|
}
|
|
76615
|
-
function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
|
|
76616
|
-
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
76617
|
-
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
76618
|
-
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
76619
|
-
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
76620
|
-
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
76621
|
-
}
|
|
76622
76617
|
function checkClassForDuplicateDeclarations(node) {
|
|
76623
76618
|
const instanceNames = /* @__PURE__ */ new Map();
|
|
76624
76619
|
const staticNames = /* @__PURE__ */ new Map();
|
|
@@ -106827,7 +106822,7 @@ ${lanes.join("\n")}
|
|
|
106827
106822
|
|
|
106828
106823
|
// src/compiler/transformers/declarations/diagnostics.ts
|
|
106829
106824
|
function canProduceDiagnostics(node) {
|
|
106830
|
-
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isJSDocTypeAlias(node);
|
|
106825
|
+
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isJSDocTypeAlias(node);
|
|
106831
106826
|
}
|
|
106832
106827
|
function createGetSymbolAccessibilityDiagnosticForNodeName(node) {
|
|
106833
106828
|
if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
@@ -106873,7 +106868,7 @@ ${lanes.join("\n")}
|
|
|
106873
106868
|
}
|
|
106874
106869
|
}
|
|
106875
106870
|
function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
106876
|
-
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
106871
|
+
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
106877
106872
|
return getVariableDeclarationTypeVisibilityError;
|
|
106878
106873
|
} else if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
106879
106874
|
return getAccessorDeclarationTypeVisibilityError;
|
|
@@ -106898,7 +106893,7 @@ ${lanes.join("\n")}
|
|
|
106898
106893
|
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
|
|
106899
106894
|
if (node.kind === 258 /* VariableDeclaration */ || node.kind === 206 /* BindingElement */) {
|
|
106900
106895
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
|
106901
|
-
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
106896
|
+
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 210 /* ElementAccessExpression */ || node.kind === 224 /* BinaryExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
106902
106897
|
if (isStatic(node)) {
|
|
106903
106898
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
|
106904
106899
|
} else if (node.parent.kind === 261 /* ClassDeclaration */ || node.kind === 167 /* Parameter */) {
|
|
@@ -108356,13 +108351,16 @@ ${lanes.join("\n")}
|
|
|
108356
108351
|
fakespace.symbol = props[0].parent;
|
|
108357
108352
|
const exportMappings = [];
|
|
108358
108353
|
let declarations = mapDefined(props, (p) => {
|
|
108359
|
-
if (!p.valueDeclaration || !isPropertyAccessExpression(p.valueDeclaration)) {
|
|
108354
|
+
if (!p.valueDeclaration || !(isPropertyAccessExpression(p.valueDeclaration) || isElementAccessExpression(p.valueDeclaration) || isBinaryExpression(p.valueDeclaration))) {
|
|
108355
|
+
return void 0;
|
|
108356
|
+
}
|
|
108357
|
+
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
108358
|
+
if (!isIdentifierText(nameStr, 99 /* ESNext */)) {
|
|
108360
108359
|
return void 0;
|
|
108361
108360
|
}
|
|
108362
108361
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
108363
108362
|
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
108364
108363
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
108365
|
-
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
108366
108364
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
108367
108365
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
108368
108366
|
if (isNonContextualKeywordName) {
|
package/lib/typescript.js
CHANGED
|
@@ -48377,6 +48377,10 @@ ${lanes.join("\n")}
|
|
|
48377
48377
|
return;
|
|
48378
48378
|
merged.exports.set(name, merged.exports.has(name) ? mergeSymbol(merged.exports.get(name), s) : s);
|
|
48379
48379
|
});
|
|
48380
|
+
if (merged === exported) {
|
|
48381
|
+
getSymbolLinks(merged).resolvedExports = void 0;
|
|
48382
|
+
getSymbolLinks(merged).resolvedMembers = void 0;
|
|
48383
|
+
}
|
|
48380
48384
|
getSymbolLinks(merged).cjsExportMerged = merged;
|
|
48381
48385
|
return links.cjsExportMerged = merged;
|
|
48382
48386
|
}
|
|
@@ -51830,7 +51834,8 @@ ${lanes.join("\n")}
|
|
|
51830
51834
|
), modifierFlags);
|
|
51831
51835
|
}
|
|
51832
51836
|
function getNamespaceMembersForSerialization(symbol) {
|
|
51833
|
-
|
|
51837
|
+
const exports = getExportsOfSymbol(symbol);
|
|
51838
|
+
return !exports ? [] : filter(arrayFrom(exports.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
|
|
51834
51839
|
}
|
|
51835
51840
|
function isTypeOnlyNamespace(symbol) {
|
|
51836
51841
|
return every(getNamespaceMembersForSerialization(symbol), (m) => !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
|
|
@@ -55633,9 +55638,10 @@ ${lanes.join("\n")}
|
|
|
55633
55638
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
55634
55639
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
55635
55640
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
55636
|
-
const
|
|
55637
|
-
const
|
|
55638
|
-
const
|
|
55641
|
+
const mappedType = type.target || type;
|
|
55642
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
55643
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
55644
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
55639
55645
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
55640
55646
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
55641
55647
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -55672,7 +55678,7 @@ ${lanes.join("\n")}
|
|
|
55672
55678
|
prop.links.keyType = keyType;
|
|
55673
55679
|
if (modifiersProp) {
|
|
55674
55680
|
prop.links.syntheticOrigin = modifiersProp;
|
|
55675
|
-
prop.declarations =
|
|
55681
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
55676
55682
|
}
|
|
55677
55683
|
members.set(propName, prop);
|
|
55678
55684
|
}
|
|
@@ -55778,6 +55784,10 @@ ${lanes.join("\n")}
|
|
|
55778
55784
|
}
|
|
55779
55785
|
return false;
|
|
55780
55786
|
}
|
|
55787
|
+
function isFilteringMappedType(type) {
|
|
55788
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
55789
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
55790
|
+
}
|
|
55781
55791
|
function resolveStructuredTypeMembers(type) {
|
|
55782
55792
|
if (!type.members) {
|
|
55783
55793
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -56137,7 +56147,7 @@ ${lanes.join("\n")}
|
|
|
56137
56147
|
const typeVariable = getHomomorphicTypeVariable(type);
|
|
56138
56148
|
if (typeVariable && !type.declaration.nameType) {
|
|
56139
56149
|
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
56140
|
-
if (constraint &&
|
|
56150
|
+
if (constraint && isArrayType(constraint)) {
|
|
56141
56151
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
56142
56152
|
}
|
|
56143
56153
|
}
|
|
@@ -59317,8 +59327,7 @@ ${lanes.join("\n")}
|
|
|
59317
59327
|
}
|
|
59318
59328
|
}
|
|
59319
59329
|
if (isGenericMappedType(objectType)) {
|
|
59320
|
-
|
|
59321
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
59330
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
59322
59331
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
59323
59332
|
}
|
|
59324
59333
|
}
|
|
@@ -68805,21 +68814,7 @@ ${lanes.join("\n")}
|
|
|
68805
68814
|
}
|
|
68806
68815
|
const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
|
|
68807
68816
|
if (signature && !isResolvingReturnTypeOfSignature(signature)) {
|
|
68808
|
-
|
|
68809
|
-
return filterType(getReturnTypeOfSignature(signature), (returnType2) => {
|
|
68810
|
-
if (functionFlags & 1 /* Generator */) {
|
|
68811
|
-
return checkGeneratorInstantiationAssignabilityToReturnType(
|
|
68812
|
-
returnType2,
|
|
68813
|
-
functionFlags,
|
|
68814
|
-
/*errorNode*/
|
|
68815
|
-
void 0
|
|
68816
|
-
);
|
|
68817
|
-
}
|
|
68818
|
-
if (functionFlags & 2 /* Async */) {
|
|
68819
|
-
return !!getAwaitedTypeOfPromise(returnType2);
|
|
68820
|
-
}
|
|
68821
|
-
return true;
|
|
68822
|
-
});
|
|
68817
|
+
return getReturnTypeOfSignature(signature);
|
|
68823
68818
|
}
|
|
68824
68819
|
const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
68825
68820
|
if (iife) {
|
|
@@ -70077,7 +70072,7 @@ ${lanes.join("\n")}
|
|
|
70077
70072
|
}
|
|
70078
70073
|
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
70079
70074
|
const attributes = openingLikeElement.attributes;
|
|
70080
|
-
const
|
|
70075
|
+
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
70081
70076
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
70082
70077
|
let attributesTable = createSymbolTable();
|
|
70083
70078
|
let spread = emptyJsxObjectType;
|
|
@@ -70104,12 +70099,18 @@ ${lanes.join("\n")}
|
|
|
70104
70099
|
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
|
|
70105
70100
|
explicitlySpecifyChildrenAttribute = true;
|
|
70106
70101
|
}
|
|
70107
|
-
if (
|
|
70108
|
-
const prop = getPropertyOfType(
|
|
70102
|
+
if (contextualType) {
|
|
70103
|
+
const prop = getPropertyOfType(contextualType, member.escapedName);
|
|
70109
70104
|
if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
|
|
70110
70105
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
70111
70106
|
}
|
|
70112
70107
|
}
|
|
70108
|
+
if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
70109
|
+
const inferenceContext = getInferenceContext(attributes);
|
|
70110
|
+
Debug.assert(inferenceContext);
|
|
70111
|
+
const inferenceNode = attributeDecl.initializer.expression;
|
|
70112
|
+
addIntraExpressionInferenceSite(inferenceContext, inferenceNode, exprType);
|
|
70113
|
+
}
|
|
70113
70114
|
} else {
|
|
70114
70115
|
Debug.assert(attributeDecl.kind === 291 /* JsxSpreadAttribute */);
|
|
70115
70116
|
if (attributesTable.size > 0) {
|
|
@@ -70164,12 +70165,12 @@ ${lanes.join("\n")}
|
|
|
70164
70165
|
if (explicitlySpecifyChildrenAttribute) {
|
|
70165
70166
|
error(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
70166
70167
|
}
|
|
70167
|
-
const
|
|
70168
|
+
const contextualType2 = getApparentTypeOfContextualType(
|
|
70168
70169
|
openingLikeElement.attributes,
|
|
70169
70170
|
/*contextFlags*/
|
|
70170
70171
|
void 0
|
|
70171
70172
|
);
|
|
70172
|
-
const childrenContextualType =
|
|
70173
|
+
const childrenContextualType = contextualType2 && getTypeOfPropertyOfContextualType(contextualType2, jsxChildrenPropertyName);
|
|
70173
70174
|
const childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
70174
70175
|
childrenPropSymbol.links.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
|
|
70175
70176
|
childrenPropSymbol.valueDeclaration = factory.createPropertySignature(
|
|
@@ -74602,6 +74603,11 @@ ${lanes.join("\n")}
|
|
|
74602
74603
|
} else {
|
|
74603
74604
|
assignNonContextualParameterTypes(signature);
|
|
74604
74605
|
}
|
|
74606
|
+
} else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
|
74607
|
+
const inferenceContext = getInferenceContext(node);
|
|
74608
|
+
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
74609
|
+
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
74610
|
+
}
|
|
74605
74611
|
}
|
|
74606
74612
|
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
|
74607
74613
|
const returnType = getReturnTypeFromBody(node, checkMode);
|
|
@@ -75791,15 +75797,7 @@ ${lanes.join("\n")}
|
|
|
75791
75797
|
checkExternalEmitHelpers(node, 256 /* Values */);
|
|
75792
75798
|
}
|
|
75793
75799
|
}
|
|
75794
|
-
|
|
75795
|
-
if (returnType && returnType.flags & 1048576 /* Union */) {
|
|
75796
|
-
returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
|
|
75797
|
-
t,
|
|
75798
|
-
functionFlags,
|
|
75799
|
-
/*errorNode*/
|
|
75800
|
-
void 0
|
|
75801
|
-
));
|
|
75802
|
-
}
|
|
75800
|
+
const returnType = getReturnTypeFromAnnotation(func);
|
|
75803
75801
|
const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
|
|
75804
75802
|
const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
|
|
75805
75803
|
const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
|
|
@@ -76601,7 +76599,11 @@ ${lanes.join("\n")}
|
|
|
76601
76599
|
if (returnType === voidType) {
|
|
76602
76600
|
error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
76603
76601
|
} else {
|
|
76604
|
-
|
|
76602
|
+
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
|
|
76603
|
+
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
76604
|
+
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
|
|
76605
|
+
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
|
|
76606
|
+
checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
|
|
76605
76607
|
}
|
|
76606
76608
|
} else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
76607
76609
|
checkAsyncFunctionReturnType(node, returnTypeNode);
|
|
@@ -76612,13 +76614,6 @@ ${lanes.join("\n")}
|
|
|
76612
76614
|
}
|
|
76613
76615
|
}
|
|
76614
76616
|
}
|
|
76615
|
-
function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
|
|
76616
|
-
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
76617
|
-
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
76618
|
-
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
76619
|
-
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
76620
|
-
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
76621
|
-
}
|
|
76622
76617
|
function checkClassForDuplicateDeclarations(node) {
|
|
76623
76618
|
const instanceNames = /* @__PURE__ */ new Map();
|
|
76624
76619
|
const staticNames = /* @__PURE__ */ new Map();
|
|
@@ -106827,7 +106822,7 @@ ${lanes.join("\n")}
|
|
|
106827
106822
|
|
|
106828
106823
|
// src/compiler/transformers/declarations/diagnostics.ts
|
|
106829
106824
|
function canProduceDiagnostics(node) {
|
|
106830
|
-
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isJSDocTypeAlias(node);
|
|
106825
|
+
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isJSDocTypeAlias(node);
|
|
106831
106826
|
}
|
|
106832
106827
|
function createGetSymbolAccessibilityDiagnosticForNodeName(node) {
|
|
106833
106828
|
if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
@@ -106873,7 +106868,7 @@ ${lanes.join("\n")}
|
|
|
106873
106868
|
}
|
|
106874
106869
|
}
|
|
106875
106870
|
function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
106876
|
-
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
106871
|
+
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
106877
106872
|
return getVariableDeclarationTypeVisibilityError;
|
|
106878
106873
|
} else if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
106879
106874
|
return getAccessorDeclarationTypeVisibilityError;
|
|
@@ -106898,7 +106893,7 @@ ${lanes.join("\n")}
|
|
|
106898
106893
|
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
|
|
106899
106894
|
if (node.kind === 258 /* VariableDeclaration */ || node.kind === 206 /* BindingElement */) {
|
|
106900
106895
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
|
106901
|
-
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
106896
|
+
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 210 /* ElementAccessExpression */ || node.kind === 224 /* BinaryExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
106902
106897
|
if (isStatic(node)) {
|
|
106903
106898
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
|
106904
106899
|
} else if (node.parent.kind === 261 /* ClassDeclaration */ || node.kind === 167 /* Parameter */) {
|
|
@@ -108356,13 +108351,16 @@ ${lanes.join("\n")}
|
|
|
108356
108351
|
fakespace.symbol = props[0].parent;
|
|
108357
108352
|
const exportMappings = [];
|
|
108358
108353
|
let declarations = mapDefined(props, (p) => {
|
|
108359
|
-
if (!p.valueDeclaration || !isPropertyAccessExpression(p.valueDeclaration)) {
|
|
108354
|
+
if (!p.valueDeclaration || !(isPropertyAccessExpression(p.valueDeclaration) || isElementAccessExpression(p.valueDeclaration) || isBinaryExpression(p.valueDeclaration))) {
|
|
108355
|
+
return void 0;
|
|
108356
|
+
}
|
|
108357
|
+
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
108358
|
+
if (!isIdentifierText(nameStr, 99 /* ESNext */)) {
|
|
108360
108359
|
return void 0;
|
|
108361
108360
|
}
|
|
108362
108361
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
108363
108362
|
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
108364
108363
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
108365
|
-
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
108366
108364
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
108367
108365
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
108368
108366
|
if (isNonContextualKeywordName) {
|
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.1.0-pr-
|
|
5
|
+
"version": "5.1.0-pr-52609-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": "14.21.1",
|
|
115
115
|
"npm": "8.19.3"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "0c1647226bdcc16d100228106d967756f79dd88f"
|
|
118
118
|
}
|