`Result value must be used` check
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- compilers
Research direction
This issue is a design discussion about expressing a “must use the result” check in the TypeScript compiler, with ImmutableJS and Rust’s #[must_use] annotation as examples. No implementation files, tests, or compiler entry points are identified; first clarify the language design and expected behavior before locating the relevant checker and test areas.
Written by the indexing model from the issue text.
Description
Hello.
Quite often while working with ImmutableJS data structures and other immutable libraries people forget that values are immutable:
They can accidentally write:
obj.set('name', 'newName');
Instead of:
let newObj = obj.set('name', 'newName');
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.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/TypeScript
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
microsoft/TypeScript#64322 · 2 comments · 1 reaction · 2 assignees ·
-
Possible Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/TypeScript#64278 · 1 comment · 1 reaction ·
-
Docs
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microsoft/TypeScript#64118 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
microsoft/TypeScript#64094 ·
-
Docs
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
microsoft/TypeScript#63959 · 5 comments ·
All issues in microsoft/TypeScript
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100