Skip to content
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

Deprecated property could be marked as strikethrough #45657

Open
5 tasks done
oldrich-s opened this issue Aug 31, 2021 · 3 comments
Open
5 tasks done

Deprecated property could be marked as strikethrough #45657

oldrich-s opened this issue Aug 31, 2021 · 3 comments
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@oldrich-s
Copy link

oldrich-s commented Aug 31, 2021

Suggestion

πŸ” Search Terms

deprecated strike

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

πŸ“ƒ Motivating Example

type X = {
    /** @deprecated */
    x: string
}

function fn (v: X) {}

fn({ x: 'test' })

https://www.typescriptlang.org/play?#code/C4TwDgpgBAGlC8UDeAoK6oHoBU2oAEATCMAJwgGMBDYCQqbTNDADwC4oBnYUgSwDsA5igC+KFADMArvwrBeAe35QJygBQA3DjACUycWMn81SKOygByWtwtQROoA

The x part of x: 'test' could be marked as strikethrough (x).

πŸ’» Use Cases

People that copy-paste code will never figure out that the property has been deprecated unless they hover the property which is very unlikely. Strikethrough would immediately indicate that the copy-pasted code contains a deprecated property.

@oldrich-s oldrich-s changed the title Deprecated property should be marked as strikeout Deprecated property could be marked as strikeout Aug 31, 2021
@oldrich-s oldrich-s changed the title Deprecated property could be marked as strikeout Deprecated property could be marked as strikethrough Aug 31, 2021
@orta
Copy link
Contributor

orta commented Aug 31, 2021

For inside the playground? This would need to be added to monaco-typescript: https://github.com/microsoft/monaco-typescript - you're welcome to give it a shot. I'll move this issue to the TS website repo if that's what you're talking about?

@IllusionMH
Copy link
Contributor

IllusionMH commented Aug 31, 2021

My assumption is that is not just for playground (screenshot from VS Code)
image

If I understood correctly: Idea is to show deprecations for properties inside of object literal that is assigned/passed to place with type that has deprecated field.

@andrewbranch andrewbranch added In Discussion Not yet reached consensus Suggestion An idea for TypeScript labels Aug 31, 2021
@oldrich-s
Copy link
Author

oldrich-s commented Sep 1, 2021

Yes exactly.

I traced it to this._languageService.getSuggestionDiagnostics(fileName); which only returns diagnostics for a.longerName; // marked as deprecated but not for longerName: 'test'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants