Certain constant expressions don't get simplified or removed
- Dominant language
- JavaScript
- Stars
- 4.4k
- Forks
- 217
- PR merge metrics
- No merged PRs in 30d
Description
These expressions can be always simplified:
```
({}) === ({}) // each object literal is unique object
({} === 3 ? 1 : 1) // object never equals number, and === comparison is guaranteed not to cause side effects
(new Date() === 3 ? 1 : 1) // new operator can't return primitive value
(new Date() === {})
(new Array() === [])
(new Array() === 5) // new operator can't return primitive value
(new Date() === 685) // new operator can't return primitive value
```
Contributor guide
Research direction
The issue names no files or tests. Start by locating the constant-expression simplification logic and its tests, then check how the listed strict-equality and conditional expressions are handled. Done means the examples are simplified or removed without changing semantics, with regression coverage for the supported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100