You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
I have thought of something which would be a very good use of TSLint's ability to check for problems including type information, where it might not be acceptable to include a sanity check in TypeScript itself. I think it would be nice of TSLint had a rule for forbidding deletion of required attributes for objects.
Consider the following code.
constx={foo: 3}deletex.foo
The type of x is {foo: number}, but after the line which deletes the attribute foo, this is no longer true. TypeScript won't warn about about this at all, and allows you to delete any attribute at all.
I think TSLint should have a rule whereby deletion of optional attributes is allowed, but deletion of attributes which are non-optional is forbidden. This would help to eliminate more errors in your code.
Let me know what you think.
The text was updated successfully, but these errors were encountered:
Note: per #4534, this issue will be closed in less than a month if no PR is sent to add the rule. If you really need the rule, custom rules are always an option and can be maintained outside this repo!
I have thought of something which would be a very good use of TSLint's ability to check for problems including type information, where it might not be acceptable to include a sanity check in TypeScript itself. I think it would be nice of TSLint had a rule for forbidding deletion of required attributes for objects.
Consider the following code.
The type of
x
is{foo: number}
, but after the line which deletes the attributefoo
, this is no longer true. TypeScript won't warn about about this at all, and allows you to delete any attribute at all.I think TSLint should have a rule whereby deletion of optional attributes is allowed, but deletion of attributes which are non-optional is forbidden. This would help to eliminate more errors in your code.
Let me know what you think.
The text was updated successfully, but these errors were encountered: