microsoft / microsoft/TypeScript
Issue better error message for binary operations between numbers and bigints
Open
Nobody has claimed this yet.
Domain: Error Messages
Experience Enhancement
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
declare let x: bigint;
declare let y: number;
x + y;
y + x;
x - y;
y - x;
x * y;
y * x;
x / y;
y / x;
x += y;
y += x;
Each of these gives an error like "Operator '{0}' cannot be applied to types '{1}' and '{2}'". It should somehow tell the user that the number argument needs to be converted to a bigint.
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.
Research direction
Start by reproducing the reported TypeScript snippet and inspecting the type-checking path that reports binary-operation errors. Done means the diagnostics for number/bigint operations clearly explain that the number operand must be converted to a bigint, including the compound-assignment cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100