-
Notifications
You must be signed in to change notification settings - Fork 12.8k
@deprecated strikethrough doesn't appear in many cases, such as JSX elements, const arrow functions, or properties. #39374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks, I'll take a look |
Another case: TS Play |
One cause of this is because current implementation reports deprecation (calling Maybe we can place |
Arrow function case is already resolved at least in TS 4.4.3. |
Have the same issue. Sample code: f();
/**
* @deprecated
*/
function f(): void {}
function x(): void {}
/**
* @deprecated
*/
x.y = (): void => {};
x.y(); I get ts warning for "f();" but not for "x.y();" |
One more example here, although admittedly perhaps quite niche: Since whole namespaces can be deprecated, and the hover-message shows the deprecation, I would expect it to be shown strikethrough. |
I did a little exploration of new TS 4.8 and found that it now tracks deprecations in node/symbol flags. Here is a code example that I used. Here are the screenshots: And property declaration (nor it's identifier) does not (as they have their own PropertyAssignment symbol): And then property access is marked with deprecated flag (via PropertySignature symbol): So the potential fix could be to link PropertyAssignment symbol to original PropertySignature or at least to take deprecation flag from it. |
Any updates on this? This would be quite usefull when working on a big shared code-base |
@RyanCavanaugh the lack of this feature influences library API design negatively. Could it be reconsidered for the next minor version? Without a strikethrough for deprecated methods and parameters, I as a library designer (eg; the |
We were looking for a solution as well and search pointed to this issue. Just to mention a test tried today on deprecated property in TS playground. When referencing the property from the object instance the property is correctly highlighted, as in: userInfo.sex; But when creating an object and filling the property, that is not highlighted: const anotherInfo: AccountInfo = {
...
sex: 'female',
} Here's the link to playground. |
2025 Update: All the originally reported missing strikethroughs are resolved except for property assignments in object literals. Edit: Unfortunately, the PR that adds the strikethrough there is too risky and has been untouched for 3 years, so it's not a viable fix. |
@sandersn can you share if this gets priority soon? Strikethrough really would help out in my current work prioritising development of new stuff in favour of deprecated, and further codebase refactoring. |
The team is unlikely to have time to look at this because we're busy porting to Go right now. |
TypeScript Version: 4.0.0-dev.20200701
VS Code Version: 1.47.0-insider commit: b16b467
Search Terms:
deprecated
Code
Expected behavior:
All deprecated usages have strikethrough styles:
<Component>
, theold
prop onComponent
,deprecatedFunction
,old
Actual behavior:

Only
props
andoptions
have strikethrough styles.Playground Link:
Strikethrough isn't visible here, but
...
is (just like stable VS Code vs. Insiders).https://www.typescriptlang.org/play/?jsx=2&ts=4.0.0-beta&ssl=29&ssc=1&pln=1&pc=1#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgIilQ3wG4AocgegCoa4ABAEyTCLRRiSbhqvJgBPMEjgAFHGADOcALxwA3uThxa9Zq3aduvfiogAbJgC44UmFGAA7AOYAaZXCtIA7qfOXbDgL6U1jFjYkDi4ePnI0CCtzOABhXEhnK3h5AAo2CGlTCUypAEo5AD44AB4mYAA3VUKKchL48CikZLhDJll8NvwnVw7nF26qQr86AM1g7TD+IRE4AHkwGGAomXklFX8NIJCdcP0jdwtrGwoVfsPPE-JfalGtrVDdCJX4QIfuADEAVysMZas5HBUpklitTAtQdECrJigobm8JqFvr9Ial1q0DgR8A4zq5TPgABbAbHXPIUIA
Related Issues:
None (feature is new to 4.0)
The text was updated successfully, but these errors were encountered: