File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -28375,6 +28375,7 @@ namespace ts {
28375
28375
*/
28376
28376
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement: JsxOpeningLikeElement, checkMode: CheckMode | undefined) {
28377
28377
const attributes = openingLikeElement.attributes;
28378
+ const attributesType = getContextualType(attributes, ContextFlags.None);
28378
28379
const allAttributesTable = strictNullChecks ? createSymbolTable() : undefined;
28379
28380
let attributesTable = createSymbolTable();
28380
28381
let spread: Type = emptyJsxObjectType;
@@ -28403,6 +28404,12 @@ namespace ts {
28403
28404
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
28404
28405
explicitlySpecifyChildrenAttribute = true;
28405
28406
}
28407
+ if (attributesType) {
28408
+ const prop = getPropertyOfType(attributesType, member.escapedName);
28409
+ if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
28410
+ addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText as string);
28411
+ }
28412
+ }
28406
28413
}
28407
28414
else {
28408
28415
Debug.assert(attributeDecl.kind === SyntaxKind.JsxSpreadAttribute);
Original file line number Diff line number Diff line change
1
+ ///<reference path="fourslash.ts" />
2
+
3
+ // @jsx : preserve
4
+ // @filename : foo.tsx
5
+ ////interface Props {
6
+ //// /** @deprecated */
7
+ //// x: number;
8
+ //// y: number;
9
+ //// }
10
+ ////function A(props: Props) {
11
+ //// return <div>{props.y}</div>
12
+ //// }
13
+ ////function B() {
14
+ //// return <A [|x|]={1} [|y|]={1} />
15
+ //// }
16
+
17
+ const [ range ] = test . ranges ( ) ;
18
+ verify . getSuggestionDiagnostics ( [
19
+ {
20
+ "code" : 6385 ,
21
+ "message" : "'x' is deprecated." ,
22
+ "reportsDeprecated" : true ,
23
+ "range" : range
24
+ } ,
25
+ ] ) ;
You can’t perform that action at this time.
0 commit comments