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

Typescript intellisense does not recognize 'delete'd attributes #26549

Closed
mjbvz opened this issue Aug 20, 2018 · 5 comments
Closed

Typescript intellisense does not recognize 'delete'd attributes #26549

mjbvz opened this issue Aug 20, 2018 · 5 comments
Labels
VS Code Tracked There is a VS Code equivalent to this issue Won't Fix The severity and priority of this issue do not warrant the time or complexity needed to fix it

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Aug 20, 2018

From @Barbiero on August 14, 2018 11:30

Whenever you deletean attribute from an object, I'd expect intellisense to recognize that said attribute was removed.
Example of the problem:
example

The expected behavior would be for the autocomplete feature to NOT show the date attribute. Furthermore, if I were to call anything over said property(say, example.date.toISOString()) it should warn me of the undefined call. deleteing an attribute from a class/interface that does not define it as an optional attribute should also be an error IMO, though I don't know how feasible that is.

Either way, VSCode(or the typescript language server?) has no support for the side effects of delete atm.

  • VSCode Version: 1.26

Does this issue occur when all extensions are disabled?: Yes

Copied from original issue: microsoft/vscode#56340

@mjbvz mjbvz self-assigned this Aug 20, 2018
@mjbvz mjbvz removed their assignment Aug 20, 2018
@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Aug 20, 2018
@RyanCavanaugh RyanCavanaugh added the Won't Fix The severity and priority of this issue do not warrant the time or complexity needed to fix it label Aug 21, 2018
@RyanCavanaugh
Copy link
Member

This isn't a common enough pattern to warrant the complexity needed to support it.

@ghost
Copy link

ghost commented Aug 22, 2018

Related: #26549

@ajafff
Copy link
Contributor

ajafff commented Aug 28, 2018

As TypeScript won't fix type inference on delete, I wrote a linter rule to disallow delete on required properties: delete-only-optional-property
For a description on how to use it, see https://github.com/fimbullinter/wotan/blob/master/packages/wotan/README.md

@Vanuan
Copy link

Vanuan commented Feb 24, 2020

That would be invalid code.

Deleting non-optional properties should be prohibited.
Delete shouldn't mutate the type of a variable.

@rreeves8
Copy link

what if they're optional ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VS Code Tracked There is a VS Code equivalent to this issue Won't Fix The severity and priority of this issue do not warrant the time or complexity needed to fix it
Projects
None yet
Development

No branches or pull requests

5 participants