typescript 5.5.0-dev.20240509 → 5.5.0-dev.20240510

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 CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240509`;
21
+ var version = `${versionMajorMinor}.0-dev.20240510`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -11908,6 +11908,10 @@ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
11908
11908
  const kind = node.kind;
11909
11909
  return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */ || kind === 205 /* ImportType */;
11910
11910
  }
11911
+ function isPropertyAccessOrQualifiedName(node) {
11912
+ const kind = node.kind;
11913
+ return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */;
11914
+ }
11911
11915
  function isCallLikeOrFunctionLikeExpression(node) {
11912
11916
  return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node);
11913
11917
  }
@@ -47658,37 +47662,6 @@ function createTypeChecker(host) {
47658
47662
  }
47659
47663
  return void 0;
47660
47664
  }
47661
- function markExportAsReferenced(node) {
47662
- if (!canCollectSymbolAliasAccessabilityData) {
47663
- return;
47664
- }
47665
- const symbol = getSymbolOfDeclaration(node);
47666
- const target = resolveAlias(symbol);
47667
- if (target) {
47668
- const markAlias = target === unknownSymbol || getSymbolFlags(
47669
- symbol,
47670
- /*excludeTypeOnlyMeanings*/
47671
- true
47672
- ) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
47673
- if (markAlias) {
47674
- markAliasSymbolAsReferenced(symbol);
47675
- }
47676
- }
47677
- }
47678
- function markAliasSymbolAsReferenced(symbol) {
47679
- Debug.assert(canCollectSymbolAliasAccessabilityData);
47680
- const links = getSymbolLinks(symbol);
47681
- if (!links.referenced) {
47682
- links.referenced = true;
47683
- const node = getDeclarationOfAliasSymbol(symbol);
47684
- if (!node) return Debug.fail();
47685
- if (isInternalModuleImportEqualsDeclaration(node)) {
47686
- if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
47687
- checkExpressionCached(node.moduleReference);
47688
- }
47689
- }
47690
- }
47691
- }
47692
47665
  function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
47693
47666
  if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
47694
47667
  entityName = entityName.parent;
@@ -68913,6 +68886,248 @@ function createTypeChecker(host) {
68913
68886
  return false;
68914
68887
  });
68915
68888
  }
68889
+ function markLinkedReferences(location, hint, propSymbol, parentType) {
68890
+ if (!canCollectSymbolAliasAccessabilityData) {
68891
+ return;
68892
+ }
68893
+ if (location.flags & 33554432 /* Ambient */) {
68894
+ return;
68895
+ }
68896
+ switch (hint) {
68897
+ case 1 /* Identifier */:
68898
+ return markIdentifierAliasReferenced(location);
68899
+ case 2 /* Property */:
68900
+ return markPropertyAliasReferenced(location, propSymbol, parentType);
68901
+ case 3 /* ExportAssignment */:
68902
+ return markExportAssignmentAliasReferenced(location);
68903
+ case 4 /* Jsx */:
68904
+ return markJsxAliasReferenced(location);
68905
+ case 5 /* AsyncFunction */:
68906
+ return markAsyncFunctionAliasReferenced(location);
68907
+ case 6 /* ExportImportEquals */:
68908
+ return markImportEqualsAliasReferenced(location);
68909
+ case 7 /* ExportSpecifier */:
68910
+ return markExportSpecifierAliasReferenced(location);
68911
+ case 8 /* Decorator */:
68912
+ return markDecoratorAliasReferenced(location);
68913
+ case 0 /* Unspecified */: {
68914
+ if (isIdentifier(location) && (isExpressionNode(location) || isShorthandPropertyAssignment(location.parent) || isImportEqualsDeclaration(location.parent) && location.parent.moduleReference === location) && shouldMarkIdentifierAliasReferenced(location)) {
68915
+ if (isPropertyAccessOrQualifiedName(location.parent)) {
68916
+ const left = isPropertyAccessExpression(location.parent) ? location.parent.expression : location.parent.left;
68917
+ if (left !== location) return;
68918
+ }
68919
+ markIdentifierAliasReferenced(location);
68920
+ return;
68921
+ }
68922
+ if (isPropertyAccessOrQualifiedName(location)) {
68923
+ let topProp = location;
68924
+ while (isPropertyAccessOrQualifiedName(topProp)) {
68925
+ if (isPartOfTypeNode(topProp)) return;
68926
+ topProp = topProp.parent;
68927
+ }
68928
+ return markPropertyAliasReferenced(location);
68929
+ }
68930
+ if (isExportAssignment(location)) {
68931
+ return markExportAssignmentAliasReferenced(location);
68932
+ }
68933
+ if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
68934
+ return markJsxAliasReferenced(location);
68935
+ }
68936
+ if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
68937
+ return markAsyncFunctionAliasReferenced(location);
68938
+ }
68939
+ if (isImportEqualsDeclaration(location)) {
68940
+ if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
68941
+ return markImportEqualsAliasReferenced(location);
68942
+ }
68943
+ return;
68944
+ }
68945
+ if (isExportSpecifier(location)) {
68946
+ return markExportSpecifierAliasReferenced(location);
68947
+ }
68948
+ if (!compilerOptions.emitDecoratorMetadata) {
68949
+ return;
68950
+ }
68951
+ if (!canHaveDecorators(location) || !hasDecorators(location) || !location.modifiers || !nodeCanBeDecorated(legacyDecorators, location, location.parent, location.parent.parent)) {
68952
+ return;
68953
+ }
68954
+ return markDecoratorAliasReferenced(location);
68955
+ }
68956
+ default:
68957
+ Debug.assertNever(hint, `Unhandled reference hint: ${hint}`);
68958
+ }
68959
+ }
68960
+ function markIdentifierAliasReferenced(location) {
68961
+ const symbol = getResolvedSymbol(location);
68962
+ if (symbol && symbol !== argumentsSymbol && symbol !== unknownSymbol && !isThisInTypeQuery(location)) {
68963
+ markAliasReferenced(symbol, location);
68964
+ }
68965
+ }
68966
+ function markPropertyAliasReferenced(location, propSymbol, parentType) {
68967
+ const left = isPropertyAccessExpression(location) ? location.expression : location.left;
68968
+ if (isThisIdentifier(left) || !isIdentifier(left)) {
68969
+ return;
68970
+ }
68971
+ const parentSymbol = getResolvedSymbol(left);
68972
+ if (!parentSymbol || parentSymbol === unknownSymbol) {
68973
+ return;
68974
+ }
68975
+ if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location)) {
68976
+ markAliasReferenced(parentSymbol, location);
68977
+ return;
68978
+ }
68979
+ const leftType = parentType || checkExpressionCached(left);
68980
+ if (isTypeAny(leftType) || leftType === silentNeverType) {
68981
+ markAliasReferenced(parentSymbol, location);
68982
+ return;
68983
+ }
68984
+ let prop = propSymbol;
68985
+ if (!prop && !parentType) {
68986
+ const right = isPropertyAccessExpression(location) ? location.name : location.right;
68987
+ const lexicallyScopedSymbol = isPrivateIdentifier(right) && lookupSymbolForPrivateIdentifierDeclaration(right.escapedText, right);
68988
+ const assignmentKind = getAssignmentTargetKind(location);
68989
+ const apparentType = getApparentType(assignmentKind !== 0 /* None */ || isMethodAccessForCall(location) ? getWidenedType(leftType) : leftType);
68990
+ prop = isPrivateIdentifier(right) ? lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(apparentType, lexicallyScopedSymbol) || void 0 : getPropertyOfType(apparentType, right.escapedText);
68991
+ }
68992
+ if (!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && location.parent.kind === 306 /* EnumMember */))) {
68993
+ markAliasReferenced(parentSymbol, location);
68994
+ }
68995
+ return;
68996
+ }
68997
+ function markExportAssignmentAliasReferenced(location) {
68998
+ if (isIdentifier(location.expression)) {
68999
+ const id = location.expression;
69000
+ const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
69001
+ id,
69002
+ -1 /* All */,
69003
+ /*ignoreErrors*/
69004
+ true,
69005
+ /*dontResolveAlias*/
69006
+ true,
69007
+ location
69008
+ ));
69009
+ if (sym) {
69010
+ markAliasReferenced(sym, id);
69011
+ }
69012
+ }
69013
+ }
69014
+ function markJsxAliasReferenced(node) {
69015
+ if (!getJsxNamespaceContainerForImplicitImport(node)) {
69016
+ const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
69017
+ const jsxFactoryNamespace = getJsxNamespace(node);
69018
+ const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
69019
+ let jsxFactorySym;
69020
+ if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
69021
+ jsxFactorySym = resolveName(
69022
+ jsxFactoryLocation,
69023
+ jsxFactoryNamespace,
69024
+ 111551 /* Value */,
69025
+ jsxFactoryRefErr,
69026
+ /*isUse*/
69027
+ true
69028
+ );
69029
+ }
69030
+ if (jsxFactorySym) {
69031
+ jsxFactorySym.isReferenced = -1 /* All */;
69032
+ if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
69033
+ markAliasSymbolAsReferenced(jsxFactorySym);
69034
+ }
69035
+ }
69036
+ if (isJsxOpeningFragment(node)) {
69037
+ const file = getSourceFileOfNode(node);
69038
+ const localJsxNamespace = getLocalJsxNamespace(file);
69039
+ if (localJsxNamespace) {
69040
+ resolveName(
69041
+ jsxFactoryLocation,
69042
+ localJsxNamespace,
69043
+ 111551 /* Value */,
69044
+ jsxFactoryRefErr,
69045
+ /*isUse*/
69046
+ true
69047
+ );
69048
+ }
69049
+ }
69050
+ }
69051
+ return;
69052
+ }
69053
+ function markAsyncFunctionAliasReferenced(location) {
69054
+ if (languageVersion < 2 /* ES2015 */) {
69055
+ if (getFunctionFlags(location) & 2 /* Async */) {
69056
+ const returnTypeNode = getEffectiveReturnTypeNode(location);
69057
+ markTypeNodeAsReferenced(returnTypeNode);
69058
+ }
69059
+ }
69060
+ }
69061
+ function markImportEqualsAliasReferenced(location) {
69062
+ if (hasSyntacticModifier(location, 32 /* Export */)) {
69063
+ markExportAsReferenced(location);
69064
+ }
69065
+ }
69066
+ function markExportSpecifierAliasReferenced(location) {
69067
+ if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
69068
+ const exportedName = location.propertyName || location.name;
69069
+ const symbol = resolveName(
69070
+ exportedName,
69071
+ exportedName.escapedText,
69072
+ 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
69073
+ /*nameNotFoundMessage*/
69074
+ void 0,
69075
+ /*isUse*/
69076
+ true
69077
+ );
69078
+ if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
69079
+ } else {
69080
+ const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
69081
+ if (!target || getSymbolFlags(target) & 111551 /* Value */) {
69082
+ markExportAsReferenced(location);
69083
+ markIdentifierAliasReferenced(location.propertyName || location.name);
69084
+ }
69085
+ }
69086
+ return;
69087
+ }
69088
+ }
69089
+ function markDecoratorAliasReferenced(node) {
69090
+ if (compilerOptions.emitDecoratorMetadata) {
69091
+ const firstDecorator = find(node.modifiers, isDecorator);
69092
+ if (!firstDecorator) {
69093
+ return;
69094
+ }
69095
+ checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
69096
+ switch (node.kind) {
69097
+ case 263 /* ClassDeclaration */:
69098
+ const constructor = getFirstConstructorWithBody(node);
69099
+ if (constructor) {
69100
+ for (const parameter of constructor.parameters) {
69101
+ markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
69102
+ }
69103
+ }
69104
+ break;
69105
+ case 177 /* GetAccessor */:
69106
+ case 178 /* SetAccessor */:
69107
+ const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
69108
+ const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
69109
+ markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
69110
+ break;
69111
+ case 174 /* MethodDeclaration */:
69112
+ for (const parameter of node.parameters) {
69113
+ markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
69114
+ }
69115
+ markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
69116
+ break;
69117
+ case 172 /* PropertyDeclaration */:
69118
+ markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
69119
+ break;
69120
+ case 169 /* Parameter */:
69121
+ markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
69122
+ const containingSignature = node.parent;
69123
+ for (const parameter of containingSignature.parameters) {
69124
+ markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
69125
+ }
69126
+ markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
69127
+ break;
69128
+ }
69129
+ }
69130
+ }
68916
69131
  function markAliasReferenced(symbol, location) {
68917
69132
  if (!canCollectSymbolAliasAccessabilityData) {
68918
69133
  return;
@@ -68934,6 +69149,77 @@ function createTypeChecker(host) {
68934
69149
  }
68935
69150
  }
68936
69151
  }
69152
+ function markAliasSymbolAsReferenced(symbol) {
69153
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
69154
+ const links = getSymbolLinks(symbol);
69155
+ if (!links.referenced) {
69156
+ links.referenced = true;
69157
+ const node = getDeclarationOfAliasSymbol(symbol);
69158
+ if (!node) return Debug.fail();
69159
+ if (isInternalModuleImportEqualsDeclaration(node)) {
69160
+ if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
69161
+ const left = getFirstIdentifier(node.moduleReference);
69162
+ markIdentifierAliasReferenced(left);
69163
+ }
69164
+ }
69165
+ }
69166
+ }
69167
+ function markExportAsReferenced(node) {
69168
+ const symbol = getSymbolOfDeclaration(node);
69169
+ const target = resolveAlias(symbol);
69170
+ if (target) {
69171
+ const markAlias = target === unknownSymbol || getSymbolFlags(
69172
+ symbol,
69173
+ /*excludeTypeOnlyMeanings*/
69174
+ true
69175
+ ) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
69176
+ if (markAlias) {
69177
+ markAliasSymbolAsReferenced(symbol);
69178
+ }
69179
+ }
69180
+ }
69181
+ function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
69182
+ if (!typeName) return;
69183
+ const rootName = getFirstIdentifier(typeName);
69184
+ const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
69185
+ const rootSymbol = resolveName(
69186
+ rootName,
69187
+ rootName.escapedText,
69188
+ meaning,
69189
+ /*nameNotFoundMessage*/
69190
+ void 0,
69191
+ /*isUse*/
69192
+ true
69193
+ );
69194
+ if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
69195
+ if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
69196
+ markAliasSymbolAsReferenced(rootSymbol);
69197
+ } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
69198
+ const diag2 = error(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
69199
+ const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration);
69200
+ if (aliasDeclaration) {
69201
+ addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
69202
+ }
69203
+ }
69204
+ }
69205
+ }
69206
+ function markTypeNodeAsReferenced(node) {
69207
+ markEntityNameOrEntityExpressionAsReference(
69208
+ node && getEntityNameFromTypeNode(node),
69209
+ /*forDecoratorMetadata*/
69210
+ false
69211
+ );
69212
+ }
69213
+ function markDecoratorMedataDataTypeNodeAsReferenced(node) {
69214
+ const entityName = getEntityNameForDecoratorMetadata(node);
69215
+ if (entityName && isEntityName(entityName)) {
69216
+ markEntityNameOrEntityExpressionAsReference(
69217
+ entityName,
69218
+ /*forDecoratorMetadata*/
69219
+ true
69220
+ );
69221
+ }
69222
+ }
68937
69223
  function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
68938
69224
  var _a;
68939
69225
  const type = getTypeOfSymbol(symbol, checkMode);
@@ -69029,7 +69315,7 @@ function createTypeChecker(host) {
69029
69315
  return getTypeOfSymbol(symbol);
69030
69316
  }
69031
69317
  if (shouldMarkIdentifierAliasReferenced(node)) {
69032
- markAliasReferenced(symbol, node);
69318
+ markLinkedReferences(node, 1 /* Identifier */);
69033
69319
  }
69034
69320
  const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
69035
69321
  const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
@@ -71572,42 +71858,7 @@ function createTypeChecker(host) {
71572
71858
  checkGrammarJsxElement(node);
71573
71859
  }
71574
71860
  checkJsxPreconditions(node);
71575
- if (!getJsxNamespaceContainerForImplicitImport(node)) {
71576
- const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
71577
- const jsxFactoryNamespace = getJsxNamespace(node);
71578
- const jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
71579
- let jsxFactorySym;
71580
- if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
71581
- jsxFactorySym = resolveName(
71582
- jsxFactoryLocation,
71583
- jsxFactoryNamespace,
71584
- 111551 /* Value */,
71585
- jsxFactoryRefErr,
71586
- /*isUse*/
71587
- true
71588
- );
71589
- }
71590
- if (jsxFactorySym) {
71591
- jsxFactorySym.isReferenced = -1 /* All */;
71592
- if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
71593
- markAliasSymbolAsReferenced(jsxFactorySym);
71594
- }
71595
- }
71596
- if (isJsxOpeningFragment(node)) {
71597
- const file = getSourceFileOfNode(node);
71598
- const localJsxNamespace = getLocalJsxNamespace(file);
71599
- if (localJsxNamespace) {
71600
- resolveName(
71601
- jsxFactoryLocation,
71602
- localJsxNamespace,
71603
- 111551 /* Value */,
71604
- jsxFactoryRefErr,
71605
- /*isUse*/
71606
- true
71607
- );
71608
- }
71609
- }
71610
- }
71861
+ markLinkedReferences(node, 4 /* Jsx */);
71611
71862
  if (isNodeOpeningLikeElement) {
71612
71863
  const jsxOpeningLikeNode = node;
71613
71864
  const sig = getResolvedSignature(jsxOpeningLikeNode);
@@ -72038,7 +72289,13 @@ function createTypeChecker(host) {
72038
72289
  } else {
72039
72290
  if (isAnyLike) {
72040
72291
  if (isIdentifier(left) && parentSymbol) {
72041
- markAliasReferenced(parentSymbol, node);
72292
+ markLinkedReferences(
72293
+ node,
72294
+ 2 /* Property */,
72295
+ /*propSymbol*/
72296
+ void 0,
72297
+ leftType
72298
+ );
72042
72299
  }
72043
72300
  return isErrorType(apparentType) ? errorType : apparentType;
72044
72301
  }
@@ -72051,9 +72308,7 @@ function createTypeChecker(host) {
72051
72308
  node.kind === 166 /* QualifiedName */
72052
72309
  );
72053
72310
  }
72054
- if (isIdentifier(left) && parentSymbol && (getIsolatedModules(compilerOptions) || !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 306 /* EnumMember */)) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
72055
- markAliasReferenced(parentSymbol, node);
72056
- }
72311
+ markLinkedReferences(node, 2 /* Property */, prop, leftType);
72057
72312
  let propType;
72058
72313
  if (!prop) {
72059
72314
  const indexInfo = !isPrivateIdentifier(right) && (assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) || isThisTypeParameter(leftType)) ? getApplicableIndexInfoForName(apparentType, right.escapedText) : void 0;
@@ -78986,7 +79241,7 @@ function createTypeChecker(host) {
78986
79241
  return;
78987
79242
  }
78988
79243
  } else {
78989
- markTypeNodeAsReferenced(returnTypeNode);
79244
+ markLinkedReferences(node, 5 /* AsyncFunction */);
78990
79245
  if (isErrorType(returnType)) {
78991
79246
  return;
78992
79247
  }
@@ -79170,48 +79425,6 @@ function createTypeChecker(host) {
79170
79425
  voidType
79171
79426
  );
79172
79427
  }
79173
- function markTypeNodeAsReferenced(node) {
79174
- markEntityNameOrEntityExpressionAsReference(
79175
- node && getEntityNameFromTypeNode(node),
79176
- /*forDecoratorMetadata*/
79177
- false
79178
- );
79179
- }
79180
- function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
79181
- if (!typeName) return;
79182
- const rootName = getFirstIdentifier(typeName);
79183
- const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
79184
- const rootSymbol = resolveName(
79185
- rootName,
79186
- rootName.escapedText,
79187
- meaning,
79188
- /*nameNotFoundMessage*/
79189
- void 0,
79190
- /*isUse*/
79191
- true
79192
- );
79193
- if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
79194
- if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
79195
- markAliasSymbolAsReferenced(rootSymbol);
79196
- } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
79197
- const diag2 = error(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
79198
- const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration);
79199
- if (aliasDeclaration) {
79200
- addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
79201
- }
79202
- }
79203
- }
79204
- }
79205
- function markDecoratorMedataDataTypeNodeAsReferenced(node) {
79206
- const entityName = getEntityNameForDecoratorMetadata(node);
79207
- if (entityName && isEntityName(entityName)) {
79208
- markEntityNameOrEntityExpressionAsReference(
79209
- entityName,
79210
- /*forDecoratorMetadata*/
79211
- true
79212
- );
79213
- }
79214
- }
79215
79428
  function getEntityNameForDecoratorMetadata(node) {
79216
79429
  if (node) {
79217
79430
  switch (node.kind) {
@@ -79291,42 +79504,7 @@ function createTypeChecker(host) {
79291
79504
  }
79292
79505
  }
79293
79506
  }
79294
- if (compilerOptions.emitDecoratorMetadata) {
79295
- checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
79296
- switch (node.kind) {
79297
- case 263 /* ClassDeclaration */:
79298
- const constructor = getFirstConstructorWithBody(node);
79299
- if (constructor) {
79300
- for (const parameter of constructor.parameters) {
79301
- markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
79302
- }
79303
- }
79304
- break;
79305
- case 177 /* GetAccessor */:
79306
- case 178 /* SetAccessor */:
79307
- const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
79308
- const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
79309
- markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
79310
- break;
79311
- case 174 /* MethodDeclaration */:
79312
- for (const parameter of node.parameters) {
79313
- markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
79314
- }
79315
- markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
79316
- break;
79317
- case 172 /* PropertyDeclaration */:
79318
- markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
79319
- break;
79320
- case 169 /* Parameter */:
79321
- markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
79322
- const containingSignature = node.parent;
79323
- for (const parameter of containingSignature.parameters) {
79324
- markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
79325
- }
79326
- markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
79327
- break;
79328
- }
79329
- }
79507
+ markLinkedReferences(node, 8 /* Decorator */);
79330
79508
  for (const modifier of node.modifiers) {
79331
79509
  if (isDecorator(modifier)) {
79332
79510
  checkDecorator(modifier);
@@ -82667,9 +82845,7 @@ function createTypeChecker(host) {
82667
82845
  checkGrammarModifiers(node);
82668
82846
  if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
82669
82847
  checkImportBinding(node);
82670
- if (hasSyntacticModifier(node, 32 /* Export */)) {
82671
- markExportAsReferenced(node);
82672
- }
82848
+ markLinkedReferences(node, 6 /* ExportImportEquals */);
82673
82849
  if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
82674
82850
  const target = resolveAlias(getSymbolOfDeclaration(node));
82675
82851
  if (target !== unknownSymbol) {
@@ -82767,13 +82943,7 @@ function createTypeChecker(host) {
82767
82943
  if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
82768
82944
  error(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
82769
82945
  } else {
82770
- if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
82771
- markExportAsReferenced(node);
82772
- }
82773
- const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
82774
- if (!target || getSymbolFlags(target) & 111551 /* Value */) {
82775
- checkExpressionCached(node.propertyName || node.name);
82776
- }
82946
+ markLinkedReferences(node, 7 /* ExportSpecifier */);
82777
82947
  }
82778
82948
  } else {
82779
82949
  if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
@@ -82815,8 +82985,8 @@ function createTypeChecker(host) {
82815
82985
  node
82816
82986
  ));
82817
82987
  if (sym) {
82988
+ markLinkedReferences(node, 3 /* ExportAssignment */);
82818
82989
  const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(sym, 111551 /* Value */);
82819
- markAliasReferenced(sym, id);
82820
82990
  if (getSymbolFlags(sym) & 111551 /* Value */) {
82821
82991
  checkExpressionCached(id);
82822
82992
  if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && typeOnlyDeclaration) {
@@ -20,10 +20,18 @@ declare namespace ts {
20
20
  export import ClassificationType = ts.ClassificationType;
21
21
  export import CompletionsTriggerCharacter = ts.CompletionsTriggerCharacter;
22
22
  export import CompletionTriggerKind = ts.CompletionTriggerKind;
23
+ export import InlayHintKind = ts.InlayHintKind;
23
24
  export import OrganizeImportsMode = ts.OrganizeImportsMode;
25
+ export import RefactorActionInfo = ts.RefactorActionInfo;
24
26
  export import RefactorTriggerReason = ts.RefactorTriggerReason;
25
27
  export import RenameInfoFailure = ts.RenameInfoFailure;
26
28
  export import SemicolonPreference = ts.SemicolonPreference;
29
+ export import SignatureHelpCharacterTypedReason = ts.SignatureHelpCharacterTypedReason;
30
+ export import SignatureHelpInvokedReason = ts.SignatureHelpInvokedReason;
31
+ export import SignatureHelpParameter = ts.SignatureHelpParameter;
32
+ export import SignatureHelpRetriggerCharacter = ts.SignatureHelpRetriggerCharacter;
33
+ export import SignatureHelpRetriggeredReason = ts.SignatureHelpRetriggeredReason;
34
+ export import SignatureHelpTriggerCharacter = ts.SignatureHelpTriggerCharacter;
27
35
  export import SignatureHelpTriggerReason = ts.SignatureHelpTriggerReason;
28
36
  export import SymbolDisplayPart = ts.SymbolDisplayPart;
29
37
  export import UserPreferences = ts.UserPreferences;
package/lib/typescript.js CHANGED
@@ -95,7 +95,7 @@ __export(typescript_exports, {
95
95
  IndexKind: () => IndexKind,
96
96
  InferenceFlags: () => InferenceFlags,
97
97
  InferencePriority: () => InferencePriority,
98
- InlayHintKind: () => InlayHintKind,
98
+ InlayHintKind: () => InlayHintKind2,
99
99
  InlayHints: () => ts_InlayHints_exports,
100
100
  InternalEmitFlags: () => InternalEmitFlags,
101
101
  InternalSymbolName: () => InternalSymbolName,
@@ -2369,7 +2369,7 @@ module.exports = __toCommonJS(typescript_exports);
2369
2369
 
2370
2370
  // src/compiler/corePublic.ts
2371
2371
  var versionMajorMinor = "5.5";
2372
- var version = `${versionMajorMinor}.0-dev.20240509`;
2372
+ var version = `${versionMajorMinor}.0-dev.20240510`;
2373
2373
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2374
2374
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2375
2375
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -52462,37 +52462,6 @@ function createTypeChecker(host) {
52462
52462
  }
52463
52463
  return void 0;
52464
52464
  }
52465
- function markExportAsReferenced(node) {
52466
- if (!canCollectSymbolAliasAccessabilityData) {
52467
- return;
52468
- }
52469
- const symbol = getSymbolOfDeclaration(node);
52470
- const target = resolveAlias(symbol);
52471
- if (target) {
52472
- const markAlias = target === unknownSymbol || getSymbolFlags(
52473
- symbol,
52474
- /*excludeTypeOnlyMeanings*/
52475
- true
52476
- ) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
52477
- if (markAlias) {
52478
- markAliasSymbolAsReferenced(symbol);
52479
- }
52480
- }
52481
- }
52482
- function markAliasSymbolAsReferenced(symbol) {
52483
- Debug.assert(canCollectSymbolAliasAccessabilityData);
52484
- const links = getSymbolLinks(symbol);
52485
- if (!links.referenced) {
52486
- links.referenced = true;
52487
- const node = getDeclarationOfAliasSymbol(symbol);
52488
- if (!node) return Debug.fail();
52489
- if (isInternalModuleImportEqualsDeclaration(node)) {
52490
- if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
52491
- checkExpressionCached(node.moduleReference);
52492
- }
52493
- }
52494
- }
52495
- }
52496
52465
  function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
52497
52466
  if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
52498
52467
  entityName = entityName.parent;
@@ -73717,6 +73686,248 @@ function createTypeChecker(host) {
73717
73686
  return false;
73718
73687
  });
73719
73688
  }
73689
+ function markLinkedReferences(location, hint, propSymbol, parentType) {
73690
+ if (!canCollectSymbolAliasAccessabilityData) {
73691
+ return;
73692
+ }
73693
+ if (location.flags & 33554432 /* Ambient */) {
73694
+ return;
73695
+ }
73696
+ switch (hint) {
73697
+ case 1 /* Identifier */:
73698
+ return markIdentifierAliasReferenced(location);
73699
+ case 2 /* Property */:
73700
+ return markPropertyAliasReferenced(location, propSymbol, parentType);
73701
+ case 3 /* ExportAssignment */:
73702
+ return markExportAssignmentAliasReferenced(location);
73703
+ case 4 /* Jsx */:
73704
+ return markJsxAliasReferenced(location);
73705
+ case 5 /* AsyncFunction */:
73706
+ return markAsyncFunctionAliasReferenced(location);
73707
+ case 6 /* ExportImportEquals */:
73708
+ return markImportEqualsAliasReferenced(location);
73709
+ case 7 /* ExportSpecifier */:
73710
+ return markExportSpecifierAliasReferenced(location);
73711
+ case 8 /* Decorator */:
73712
+ return markDecoratorAliasReferenced(location);
73713
+ case 0 /* Unspecified */: {
73714
+ if (isIdentifier(location) && (isExpressionNode(location) || isShorthandPropertyAssignment(location.parent) || isImportEqualsDeclaration(location.parent) && location.parent.moduleReference === location) && shouldMarkIdentifierAliasReferenced(location)) {
73715
+ if (isPropertyAccessOrQualifiedName(location.parent)) {
73716
+ const left = isPropertyAccessExpression(location.parent) ? location.parent.expression : location.parent.left;
73717
+ if (left !== location) return;
73718
+ }
73719
+ markIdentifierAliasReferenced(location);
73720
+ return;
73721
+ }
73722
+ if (isPropertyAccessOrQualifiedName(location)) {
73723
+ let topProp = location;
73724
+ while (isPropertyAccessOrQualifiedName(topProp)) {
73725
+ if (isPartOfTypeNode(topProp)) return;
73726
+ topProp = topProp.parent;
73727
+ }
73728
+ return markPropertyAliasReferenced(location);
73729
+ }
73730
+ if (isExportAssignment(location)) {
73731
+ return markExportAssignmentAliasReferenced(location);
73732
+ }
73733
+ if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
73734
+ return markJsxAliasReferenced(location);
73735
+ }
73736
+ if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
73737
+ return markAsyncFunctionAliasReferenced(location);
73738
+ }
73739
+ if (isImportEqualsDeclaration(location)) {
73740
+ if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
73741
+ return markImportEqualsAliasReferenced(location);
73742
+ }
73743
+ return;
73744
+ }
73745
+ if (isExportSpecifier(location)) {
73746
+ return markExportSpecifierAliasReferenced(location);
73747
+ }
73748
+ if (!compilerOptions.emitDecoratorMetadata) {
73749
+ return;
73750
+ }
73751
+ if (!canHaveDecorators(location) || !hasDecorators(location) || !location.modifiers || !nodeCanBeDecorated(legacyDecorators, location, location.parent, location.parent.parent)) {
73752
+ return;
73753
+ }
73754
+ return markDecoratorAliasReferenced(location);
73755
+ }
73756
+ default:
73757
+ Debug.assertNever(hint, `Unhandled reference hint: ${hint}`);
73758
+ }
73759
+ }
73760
+ function markIdentifierAliasReferenced(location) {
73761
+ const symbol = getResolvedSymbol(location);
73762
+ if (symbol && symbol !== argumentsSymbol && symbol !== unknownSymbol && !isThisInTypeQuery(location)) {
73763
+ markAliasReferenced(symbol, location);
73764
+ }
73765
+ }
73766
+ function markPropertyAliasReferenced(location, propSymbol, parentType) {
73767
+ const left = isPropertyAccessExpression(location) ? location.expression : location.left;
73768
+ if (isThisIdentifier(left) || !isIdentifier(left)) {
73769
+ return;
73770
+ }
73771
+ const parentSymbol = getResolvedSymbol(left);
73772
+ if (!parentSymbol || parentSymbol === unknownSymbol) {
73773
+ return;
73774
+ }
73775
+ if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location)) {
73776
+ markAliasReferenced(parentSymbol, location);
73777
+ return;
73778
+ }
73779
+ const leftType = parentType || checkExpressionCached(left);
73780
+ if (isTypeAny(leftType) || leftType === silentNeverType) {
73781
+ markAliasReferenced(parentSymbol, location);
73782
+ return;
73783
+ }
73784
+ let prop = propSymbol;
73785
+ if (!prop && !parentType) {
73786
+ const right = isPropertyAccessExpression(location) ? location.name : location.right;
73787
+ const lexicallyScopedSymbol = isPrivateIdentifier(right) && lookupSymbolForPrivateIdentifierDeclaration(right.escapedText, right);
73788
+ const assignmentKind = getAssignmentTargetKind(location);
73789
+ const apparentType = getApparentType(assignmentKind !== 0 /* None */ || isMethodAccessForCall(location) ? getWidenedType(leftType) : leftType);
73790
+ prop = isPrivateIdentifier(right) ? lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(apparentType, lexicallyScopedSymbol) || void 0 : getPropertyOfType(apparentType, right.escapedText);
73791
+ }
73792
+ if (!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && location.parent.kind === 306 /* EnumMember */))) {
73793
+ markAliasReferenced(parentSymbol, location);
73794
+ }
73795
+ return;
73796
+ }
73797
+ function markExportAssignmentAliasReferenced(location) {
73798
+ if (isIdentifier(location.expression)) {
73799
+ const id = location.expression;
73800
+ const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
73801
+ id,
73802
+ -1 /* All */,
73803
+ /*ignoreErrors*/
73804
+ true,
73805
+ /*dontResolveAlias*/
73806
+ true,
73807
+ location
73808
+ ));
73809
+ if (sym) {
73810
+ markAliasReferenced(sym, id);
73811
+ }
73812
+ }
73813
+ }
73814
+ function markJsxAliasReferenced(node) {
73815
+ if (!getJsxNamespaceContainerForImplicitImport(node)) {
73816
+ const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
73817
+ const jsxFactoryNamespace = getJsxNamespace(node);
73818
+ const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
73819
+ let jsxFactorySym;
73820
+ if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
73821
+ jsxFactorySym = resolveName(
73822
+ jsxFactoryLocation,
73823
+ jsxFactoryNamespace,
73824
+ 111551 /* Value */,
73825
+ jsxFactoryRefErr,
73826
+ /*isUse*/
73827
+ true
73828
+ );
73829
+ }
73830
+ if (jsxFactorySym) {
73831
+ jsxFactorySym.isReferenced = -1 /* All */;
73832
+ if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
73833
+ markAliasSymbolAsReferenced(jsxFactorySym);
73834
+ }
73835
+ }
73836
+ if (isJsxOpeningFragment(node)) {
73837
+ const file = getSourceFileOfNode(node);
73838
+ const localJsxNamespace = getLocalJsxNamespace(file);
73839
+ if (localJsxNamespace) {
73840
+ resolveName(
73841
+ jsxFactoryLocation,
73842
+ localJsxNamespace,
73843
+ 111551 /* Value */,
73844
+ jsxFactoryRefErr,
73845
+ /*isUse*/
73846
+ true
73847
+ );
73848
+ }
73849
+ }
73850
+ }
73851
+ return;
73852
+ }
73853
+ function markAsyncFunctionAliasReferenced(location) {
73854
+ if (languageVersion < 2 /* ES2015 */) {
73855
+ if (getFunctionFlags(location) & 2 /* Async */) {
73856
+ const returnTypeNode = getEffectiveReturnTypeNode(location);
73857
+ markTypeNodeAsReferenced(returnTypeNode);
73858
+ }
73859
+ }
73860
+ }
73861
+ function markImportEqualsAliasReferenced(location) {
73862
+ if (hasSyntacticModifier(location, 32 /* Export */)) {
73863
+ markExportAsReferenced(location);
73864
+ }
73865
+ }
73866
+ function markExportSpecifierAliasReferenced(location) {
73867
+ if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
73868
+ const exportedName = location.propertyName || location.name;
73869
+ const symbol = resolveName(
73870
+ exportedName,
73871
+ exportedName.escapedText,
73872
+ 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
73873
+ /*nameNotFoundMessage*/
73874
+ void 0,
73875
+ /*isUse*/
73876
+ true
73877
+ );
73878
+ if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
73879
+ } else {
73880
+ const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
73881
+ if (!target || getSymbolFlags(target) & 111551 /* Value */) {
73882
+ markExportAsReferenced(location);
73883
+ markIdentifierAliasReferenced(location.propertyName || location.name);
73884
+ }
73885
+ }
73886
+ return;
73887
+ }
73888
+ }
73889
+ function markDecoratorAliasReferenced(node) {
73890
+ if (compilerOptions.emitDecoratorMetadata) {
73891
+ const firstDecorator = find(node.modifiers, isDecorator);
73892
+ if (!firstDecorator) {
73893
+ return;
73894
+ }
73895
+ checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
73896
+ switch (node.kind) {
73897
+ case 263 /* ClassDeclaration */:
73898
+ const constructor = getFirstConstructorWithBody(node);
73899
+ if (constructor) {
73900
+ for (const parameter of constructor.parameters) {
73901
+ markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
73902
+ }
73903
+ }
73904
+ break;
73905
+ case 177 /* GetAccessor */:
73906
+ case 178 /* SetAccessor */:
73907
+ const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
73908
+ const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
73909
+ markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
73910
+ break;
73911
+ case 174 /* MethodDeclaration */:
73912
+ for (const parameter of node.parameters) {
73913
+ markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
73914
+ }
73915
+ markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
73916
+ break;
73917
+ case 172 /* PropertyDeclaration */:
73918
+ markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
73919
+ break;
73920
+ case 169 /* Parameter */:
73921
+ markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
73922
+ const containingSignature = node.parent;
73923
+ for (const parameter of containingSignature.parameters) {
73924
+ markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
73925
+ }
73926
+ markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
73927
+ break;
73928
+ }
73929
+ }
73930
+ }
73720
73931
  function markAliasReferenced(symbol, location) {
73721
73932
  if (!canCollectSymbolAliasAccessabilityData) {
73722
73933
  return;
@@ -73738,6 +73949,77 @@ function createTypeChecker(host) {
73738
73949
  }
73739
73950
  }
73740
73951
  }
73952
+ function markAliasSymbolAsReferenced(symbol) {
73953
+ Debug.assert(canCollectSymbolAliasAccessabilityData);
73954
+ const links = getSymbolLinks(symbol);
73955
+ if (!links.referenced) {
73956
+ links.referenced = true;
73957
+ const node = getDeclarationOfAliasSymbol(symbol);
73958
+ if (!node) return Debug.fail();
73959
+ if (isInternalModuleImportEqualsDeclaration(node)) {
73960
+ if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
73961
+ const left = getFirstIdentifier(node.moduleReference);
73962
+ markIdentifierAliasReferenced(left);
73963
+ }
73964
+ }
73965
+ }
73966
+ }
73967
+ function markExportAsReferenced(node) {
73968
+ const symbol = getSymbolOfDeclaration(node);
73969
+ const target = resolveAlias(symbol);
73970
+ if (target) {
73971
+ const markAlias = target === unknownSymbol || getSymbolFlags(
73972
+ symbol,
73973
+ /*excludeTypeOnlyMeanings*/
73974
+ true
73975
+ ) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
73976
+ if (markAlias) {
73977
+ markAliasSymbolAsReferenced(symbol);
73978
+ }
73979
+ }
73980
+ }
73981
+ function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
73982
+ if (!typeName) return;
73983
+ const rootName = getFirstIdentifier(typeName);
73984
+ const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
73985
+ const rootSymbol = resolveName(
73986
+ rootName,
73987
+ rootName.escapedText,
73988
+ meaning,
73989
+ /*nameNotFoundMessage*/
73990
+ void 0,
73991
+ /*isUse*/
73992
+ true
73993
+ );
73994
+ if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
73995
+ if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
73996
+ markAliasSymbolAsReferenced(rootSymbol);
73997
+ } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
73998
+ const diag2 = error2(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
73999
+ const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
74000
+ if (aliasDeclaration) {
74001
+ addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
74002
+ }
74003
+ }
74004
+ }
74005
+ }
74006
+ function markTypeNodeAsReferenced(node) {
74007
+ markEntityNameOrEntityExpressionAsReference(
74008
+ node && getEntityNameFromTypeNode(node),
74009
+ /*forDecoratorMetadata*/
74010
+ false
74011
+ );
74012
+ }
74013
+ function markDecoratorMedataDataTypeNodeAsReferenced(node) {
74014
+ const entityName = getEntityNameForDecoratorMetadata(node);
74015
+ if (entityName && isEntityName(entityName)) {
74016
+ markEntityNameOrEntityExpressionAsReference(
74017
+ entityName,
74018
+ /*forDecoratorMetadata*/
74019
+ true
74020
+ );
74021
+ }
74022
+ }
73741
74023
  function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
73742
74024
  var _a;
73743
74025
  const type = getTypeOfSymbol(symbol, checkMode);
@@ -73833,7 +74115,7 @@ function createTypeChecker(host) {
73833
74115
  return getTypeOfSymbol(symbol);
73834
74116
  }
73835
74117
  if (shouldMarkIdentifierAliasReferenced(node)) {
73836
- markAliasReferenced(symbol, node);
74118
+ markLinkedReferences(node, 1 /* Identifier */);
73837
74119
  }
73838
74120
  const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
73839
74121
  const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
@@ -76376,42 +76658,7 @@ function createTypeChecker(host) {
76376
76658
  checkGrammarJsxElement(node);
76377
76659
  }
76378
76660
  checkJsxPreconditions(node);
76379
- if (!getJsxNamespaceContainerForImplicitImport(node)) {
76380
- const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
76381
- const jsxFactoryNamespace = getJsxNamespace(node);
76382
- const jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
76383
- let jsxFactorySym;
76384
- if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
76385
- jsxFactorySym = resolveName(
76386
- jsxFactoryLocation,
76387
- jsxFactoryNamespace,
76388
- 111551 /* Value */,
76389
- jsxFactoryRefErr,
76390
- /*isUse*/
76391
- true
76392
- );
76393
- }
76394
- if (jsxFactorySym) {
76395
- jsxFactorySym.isReferenced = -1 /* All */;
76396
- if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
76397
- markAliasSymbolAsReferenced(jsxFactorySym);
76398
- }
76399
- }
76400
- if (isJsxOpeningFragment(node)) {
76401
- const file = getSourceFileOfNode(node);
76402
- const localJsxNamespace = getLocalJsxNamespace(file);
76403
- if (localJsxNamespace) {
76404
- resolveName(
76405
- jsxFactoryLocation,
76406
- localJsxNamespace,
76407
- 111551 /* Value */,
76408
- jsxFactoryRefErr,
76409
- /*isUse*/
76410
- true
76411
- );
76412
- }
76413
- }
76414
- }
76661
+ markLinkedReferences(node, 4 /* Jsx */);
76415
76662
  if (isNodeOpeningLikeElement) {
76416
76663
  const jsxOpeningLikeNode = node;
76417
76664
  const sig = getResolvedSignature(jsxOpeningLikeNode);
@@ -76842,7 +77089,13 @@ function createTypeChecker(host) {
76842
77089
  } else {
76843
77090
  if (isAnyLike) {
76844
77091
  if (isIdentifier(left) && parentSymbol) {
76845
- markAliasReferenced(parentSymbol, node);
77092
+ markLinkedReferences(
77093
+ node,
77094
+ 2 /* Property */,
77095
+ /*propSymbol*/
77096
+ void 0,
77097
+ leftType
77098
+ );
76846
77099
  }
76847
77100
  return isErrorType(apparentType) ? errorType : apparentType;
76848
77101
  }
@@ -76855,9 +77108,7 @@ function createTypeChecker(host) {
76855
77108
  node.kind === 166 /* QualifiedName */
76856
77109
  );
76857
77110
  }
76858
- if (isIdentifier(left) && parentSymbol && (getIsolatedModules(compilerOptions) || !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 306 /* EnumMember */)) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
76859
- markAliasReferenced(parentSymbol, node);
76860
- }
77111
+ markLinkedReferences(node, 2 /* Property */, prop, leftType);
76861
77112
  let propType;
76862
77113
  if (!prop) {
76863
77114
  const indexInfo = !isPrivateIdentifier(right) && (assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) || isThisTypeParameter(leftType)) ? getApplicableIndexInfoForName(apparentType, right.escapedText) : void 0;
@@ -83790,7 +84041,7 @@ function createTypeChecker(host) {
83790
84041
  return;
83791
84042
  }
83792
84043
  } else {
83793
- markTypeNodeAsReferenced(returnTypeNode);
84044
+ markLinkedReferences(node, 5 /* AsyncFunction */);
83794
84045
  if (isErrorType(returnType)) {
83795
84046
  return;
83796
84047
  }
@@ -83974,48 +84225,6 @@ function createTypeChecker(host) {
83974
84225
  voidType
83975
84226
  );
83976
84227
  }
83977
- function markTypeNodeAsReferenced(node) {
83978
- markEntityNameOrEntityExpressionAsReference(
83979
- node && getEntityNameFromTypeNode(node),
83980
- /*forDecoratorMetadata*/
83981
- false
83982
- );
83983
- }
83984
- function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
83985
- if (!typeName) return;
83986
- const rootName = getFirstIdentifier(typeName);
83987
- const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
83988
- const rootSymbol = resolveName(
83989
- rootName,
83990
- rootName.escapedText,
83991
- meaning,
83992
- /*nameNotFoundMessage*/
83993
- void 0,
83994
- /*isUse*/
83995
- true
83996
- );
83997
- if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
83998
- if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
83999
- markAliasSymbolAsReferenced(rootSymbol);
84000
- } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
84001
- const diag2 = error2(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
84002
- const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
84003
- if (aliasDeclaration) {
84004
- addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
84005
- }
84006
- }
84007
- }
84008
- }
84009
- function markDecoratorMedataDataTypeNodeAsReferenced(node) {
84010
- const entityName = getEntityNameForDecoratorMetadata(node);
84011
- if (entityName && isEntityName(entityName)) {
84012
- markEntityNameOrEntityExpressionAsReference(
84013
- entityName,
84014
- /*forDecoratorMetadata*/
84015
- true
84016
- );
84017
- }
84018
- }
84019
84228
  function getEntityNameForDecoratorMetadata(node) {
84020
84229
  if (node) {
84021
84230
  switch (node.kind) {
@@ -84095,42 +84304,7 @@ function createTypeChecker(host) {
84095
84304
  }
84096
84305
  }
84097
84306
  }
84098
- if (compilerOptions.emitDecoratorMetadata) {
84099
- checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
84100
- switch (node.kind) {
84101
- case 263 /* ClassDeclaration */:
84102
- const constructor = getFirstConstructorWithBody(node);
84103
- if (constructor) {
84104
- for (const parameter of constructor.parameters) {
84105
- markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
84106
- }
84107
- }
84108
- break;
84109
- case 177 /* GetAccessor */:
84110
- case 178 /* SetAccessor */:
84111
- const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
84112
- const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
84113
- markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
84114
- break;
84115
- case 174 /* MethodDeclaration */:
84116
- for (const parameter of node.parameters) {
84117
- markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
84118
- }
84119
- markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
84120
- break;
84121
- case 172 /* PropertyDeclaration */:
84122
- markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
84123
- break;
84124
- case 169 /* Parameter */:
84125
- markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
84126
- const containingSignature = node.parent;
84127
- for (const parameter of containingSignature.parameters) {
84128
- markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
84129
- }
84130
- markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
84131
- break;
84132
- }
84133
- }
84307
+ markLinkedReferences(node, 8 /* Decorator */);
84134
84308
  for (const modifier of node.modifiers) {
84135
84309
  if (isDecorator(modifier)) {
84136
84310
  checkDecorator(modifier);
@@ -87471,9 +87645,7 @@ function createTypeChecker(host) {
87471
87645
  checkGrammarModifiers(node);
87472
87646
  if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
87473
87647
  checkImportBinding(node);
87474
- if (hasSyntacticModifier(node, 32 /* Export */)) {
87475
- markExportAsReferenced(node);
87476
- }
87648
+ markLinkedReferences(node, 6 /* ExportImportEquals */);
87477
87649
  if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
87478
87650
  const target = resolveAlias(getSymbolOfDeclaration(node));
87479
87651
  if (target !== unknownSymbol) {
@@ -87571,13 +87743,7 @@ function createTypeChecker(host) {
87571
87743
  if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
87572
87744
  error2(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
87573
87745
  } else {
87574
- if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
87575
- markExportAsReferenced(node);
87576
- }
87577
- const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
87578
- if (!target || getSymbolFlags(target) & 111551 /* Value */) {
87579
- checkExpressionCached(node.propertyName || node.name);
87580
- }
87746
+ markLinkedReferences(node, 7 /* ExportSpecifier */);
87581
87747
  }
87582
87748
  } else {
87583
87749
  if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
@@ -87619,8 +87785,8 @@ function createTypeChecker(host) {
87619
87785
  node
87620
87786
  ));
87621
87787
  if (sym) {
87788
+ markLinkedReferences(node, 3 /* ExportAssignment */);
87622
87789
  const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(sym, 111551 /* Value */);
87623
- markAliasReferenced(sym, id);
87624
87790
  if (getSymbolFlags(sym) & 111551 /* Value */) {
87625
87791
  checkExpressionCached(id);
87626
87792
  if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && typeOnlyDeclaration) {
@@ -134426,12 +134592,12 @@ var CompletionTriggerKind = /* @__PURE__ */ ((CompletionTriggerKind2) => {
134426
134592
  CompletionTriggerKind2[CompletionTriggerKind2["TriggerForIncompleteCompletions"] = 3] = "TriggerForIncompleteCompletions";
134427
134593
  return CompletionTriggerKind2;
134428
134594
  })(CompletionTriggerKind || {});
134429
- var InlayHintKind = /* @__PURE__ */ ((InlayHintKind2) => {
134430
- InlayHintKind2["Type"] = "Type";
134431
- InlayHintKind2["Parameter"] = "Parameter";
134432
- InlayHintKind2["Enum"] = "Enum";
134433
- return InlayHintKind2;
134434
- })(InlayHintKind || {});
134595
+ var InlayHintKind2 = /* @__PURE__ */ ((InlayHintKind3) => {
134596
+ InlayHintKind3["Type"] = "Type";
134597
+ InlayHintKind3["Parameter"] = "Parameter";
134598
+ InlayHintKind3["Enum"] = "Enum";
134599
+ return InlayHintKind3;
134600
+ })(InlayHintKind2 || {});
134435
134601
  var HighlightSpanKind = /* @__PURE__ */ ((HighlightSpanKind2) => {
134436
134602
  HighlightSpanKind2["none"] = "none";
134437
134603
  HighlightSpanKind2["definition"] = "definition";
@@ -177181,7 +177347,7 @@ __export(ts_exports2, {
177181
177347
  IndexKind: () => IndexKind,
177182
177348
  InferenceFlags: () => InferenceFlags,
177183
177349
  InferencePriority: () => InferencePriority,
177184
- InlayHintKind: () => InlayHintKind,
177350
+ InlayHintKind: () => InlayHintKind2,
177185
177351
  InlayHints: () => ts_InlayHints_exports,
177186
177352
  InternalEmitFlags: () => InternalEmitFlags,
177187
177353
  InternalSymbolName: () => InternalSymbolName,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.5.0-dev.20240509",
5
+ "version": "5.5.0-dev.20240510",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -110,5 +110,5 @@
110
110
  "node": "20.1.0",
111
111
  "npm": "8.19.4"
112
112
  },
113
- "gitHead": "be8fb98cf106d2f9421038dbfc9de9352f3ba4b1"
113
+ "gitHead": "9f9682c0a0339401037dd67ba5dafc24f2c297aa"
114
114
  }