@@ -13168,6 +13168,10 @@ namespace ts {
1316813168 if (propName !== undefined) {
1316913169 const prop = getPropertyOfType(objectType, propName);
1317013170 if (prop) {
13171+ if (accessNode && prop.flags & SymbolFlags.Deprecated) {
13172+ const deprecatedNode = accessExpression?.argumentExpression ?? (isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
13173+ errorOrSuggestion(/* isError */ false, deprecatedNode, Diagnostics._0_is_deprecated, propName as string);
13174+ }
1317113175 if (accessExpression) {
1317213176 markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === SyntaxKind.ThisKeyword);
1317313177 if (isAssignmentToReadonlyEntity(accessExpression, prop, getAssignmentTargetKind(accessExpression))) {
@@ -21698,6 +21702,10 @@ namespace ts {
2169821702 const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
2169921703 let declaration: Declaration | undefined = localOrExportSymbol.valueDeclaration;
2170021704
21705+ const target = (symbol.flags & SymbolFlags.Alias ? resolveAlias(symbol) : symbol);
21706+ if (target.flags & SymbolFlags.Deprecated) {
21707+ errorOrSuggestion(/* isError */ false, node, Diagnostics._0_is_deprecated, node.escapedText as string);
21708+ }
2170121709 if (localOrExportSymbol.flags & SymbolFlags.Class) {
2170221710 // Due to the emit for class decorators, any reference to the class from inside of the class body
2170321711 // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
@@ -24679,6 +24687,10 @@ namespace ts {
2467924687 propType = indexInfo.type;
2468024688 }
2468124689 else {
24690+ if (prop.flags & SymbolFlags.Deprecated) {
24691+ errorOrSuggestion(/* isError */ false, right, Diagnostics._0_is_deprecated, right.escapedText as string);
24692+ }
24693+
2468224694 checkPropertyNotUsedBeforeDeclaration(prop, node, right);
2468324695 markPropertyAsReferenced(prop, node, left.kind === SyntaxKind.ThisKeyword);
2468424696 getNodeLinks(node).resolvedSymbol = prop;
@@ -30499,8 +30511,15 @@ namespace ts {
3049930511 checkTypeArgumentConstraints(node, typeParameters);
3050030512 }
3050130513 }
30502- if (type.flags & TypeFlags.Enum && getNodeLinks(node).resolvedSymbol!.flags & SymbolFlags.EnumMember) {
30503- error(node, Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type));
30514+ const symbol = getNodeLinks(node).resolvedSymbol;
30515+ if (symbol) {
30516+ if (symbol.flags & SymbolFlags.Deprecated) {
30517+ const diagLocation = isTypeReferenceNode(node) && isQualifiedName(node.typeName) ? node.typeName.right : node;
30518+ errorOrSuggestion(/* isError */ false, diagLocation, Diagnostics._0_is_deprecated, symbol.escapedName as string);
30519+ }
30520+ if (type.flags & TypeFlags.Enum && symbol.flags & SymbolFlags.EnumMember) {
30521+ error(node, Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type));
30522+ }
3050430523 }
3050530524 }
3050630525 }
@@ -31644,6 +31663,7 @@ namespace ts {
3164431663 error(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
3164531664 }
3164631665 }
31666+
3164731667 function checkJSDocAugmentsTag(node: JSDocAugmentsTag): void {
3164831668 const classLike = getEffectiveJSDocHost(node);
3164931669 if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
@@ -34803,33 +34823,39 @@ namespace ts {
3480334823 let symbol = getSymbolOfNode(node);
3480434824 const target = resolveAlias(symbol);
3480534825
34806- const shouldSkipWithJSExpandoTargets = symbol.flags & SymbolFlags.Assignment;
34807- if (!shouldSkipWithJSExpandoTargets && target !== unknownSymbol) {
34808- // For external modules symbol represents local symbol for an alias.
34809- // This local symbol will merge any other local declarations (excluding other aliases)
34810- // and symbol.flags will contains combined representation for all merged declaration.
34811- // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
34812- // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*
34813- // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
34814- symbol = getMergedSymbol(symbol.exportSymbol || symbol);
34815- const excludedMeanings =
34816- (symbol.flags & (SymbolFlags.Value | SymbolFlags.ExportValue) ? SymbolFlags.Value : 0) |
34817- (symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) |
34818- (symbol.flags & SymbolFlags.Namespace ? SymbolFlags.Namespace : 0);
34819- if (target.flags & excludedMeanings) {
34820- const message = node.kind === SyntaxKind.ExportSpecifier ?
34821- Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
34822- Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
34823- error(node, message, symbolToString(symbol));
34824- }
34825-
34826- // Don't allow to re-export something with no value side when `--isolatedModules` is set.
34827- if (compilerOptions.isolatedModules
34828- && node.kind === SyntaxKind.ExportSpecifier
34829- && !node.parent.parent.isTypeOnly
34830- && !(target.flags & SymbolFlags.Value)
34831- && !(node.flags & NodeFlags.Ambient)) {
34832- error(node, Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type);
34826+ if (target !== unknownSymbol) {
34827+ const shouldSkipWithJSExpandoTargets = symbol.flags & SymbolFlags.Assignment;
34828+ if (!shouldSkipWithJSExpandoTargets) {
34829+ // For external modules symbol represents local symbol for an alias.
34830+ // This local symbol will merge any other local declarations (excluding other aliases)
34831+ // and symbol.flags will contains combined representation for all merged declaration.
34832+ // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
34833+ // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*
34834+ // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
34835+ symbol = getMergedSymbol(symbol.exportSymbol || symbol);
34836+ const excludedMeanings =
34837+ (symbol.flags & (SymbolFlags.Value | SymbolFlags.ExportValue) ? SymbolFlags.Value : 0) |
34838+ (symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) |
34839+ (symbol.flags & SymbolFlags.Namespace ? SymbolFlags.Namespace : 0);
34840+ if (target.flags & excludedMeanings) {
34841+ const message = node.kind === SyntaxKind.ExportSpecifier ?
34842+ Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
34843+ Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
34844+ error(node, message, symbolToString(symbol));
34845+ }
34846+
34847+ // Don't allow to re-export something with no value side when `--isolatedModules` is set.
34848+ if (compilerOptions.isolatedModules
34849+ && node.kind === SyntaxKind.ExportSpecifier
34850+ && !node.parent.parent.isTypeOnly
34851+ && !(target.flags & SymbolFlags.Value)
34852+ && !(node.flags & NodeFlags.Ambient)) {
34853+ error(node, Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type);
34854+ }
34855+ }
34856+
34857+ if (isImportSpecifier(node) && target.flags & SymbolFlags.Deprecated) {
34858+ errorOrSuggestion(/* isError */ false, node.name, Diagnostics._0_is_deprecated, symbol.escapedName as string);
3483334859 }
3483434860 }
3483534861 }
0 commit comments