@@ -13168,6 +13168,10 @@ namespace ts {
13168
13168
if (propName !== undefined) {
13169
13169
const prop = getPropertyOfType(objectType, propName);
13170
13170
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
+ }
13171
13175
if (accessExpression) {
13172
13176
markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === SyntaxKind.ThisKeyword);
13173
13177
if (isAssignmentToReadonlyEntity(accessExpression, prop, getAssignmentTargetKind(accessExpression))) {
@@ -21698,6 +21702,10 @@ namespace ts {
21698
21702
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
21699
21703
let declaration: Declaration | undefined = localOrExportSymbol.valueDeclaration;
21700
21704
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
+ }
21701
21709
if (localOrExportSymbol.flags & SymbolFlags.Class) {
21702
21710
// Due to the emit for class decorators, any reference to the class from inside of the class body
21703
21711
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
@@ -24679,6 +24687,10 @@ namespace ts {
24679
24687
propType = indexInfo.type;
24680
24688
}
24681
24689
else {
24690
+ if (prop.flags & SymbolFlags.Deprecated) {
24691
+ errorOrSuggestion(/* isError */ false, right, Diagnostics._0_is_deprecated, right.escapedText as string);
24692
+ }
24693
+
24682
24694
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
24683
24695
markPropertyAsReferenced(prop, node, left.kind === SyntaxKind.ThisKeyword);
24684
24696
getNodeLinks(node).resolvedSymbol = prop;
@@ -30499,8 +30511,15 @@ namespace ts {
30499
30511
checkTypeArgumentConstraints(node, typeParameters);
30500
30512
}
30501
30513
}
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
+ }
30504
30523
}
30505
30524
}
30506
30525
}
@@ -31644,6 +31663,7 @@ namespace ts {
31644
31663
error(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
31645
31664
}
31646
31665
}
31666
+
31647
31667
function checkJSDocAugmentsTag(node: JSDocAugmentsTag): void {
31648
31668
const classLike = getEffectiveJSDocHost(node);
31649
31669
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
@@ -34803,33 +34823,39 @@ namespace ts {
34803
34823
let symbol = getSymbolOfNode(node);
34804
34824
const target = resolveAlias(symbol);
34805
34825
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);
34833
34859
}
34834
34860
}
34835
34861
}
0 commit comments