-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Result value must be used check #8240
Copy link
Copy link
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Type
Fields
Give feedbackNo fields configured for issues without a type.
Hello.
Quite often while working with
ImmutableJSdata structures and other immutable libraries people forget that values are immutable:They can accidentally write:
Instead of:
These errors are hard to discover and they are very annoying. I think that this problem can't be solved by
tslint, so I propose to add some sort of"you must use the result"check into the compiler. But right now I have no idea how I want it to be expressed in the language, so I create this issue mainly to start a discussion.Rust lang, for example, solves a similar problem with
#[must_use]annotation. This is not exact what we want, but it's a good example and shows that the problem is quite common.