Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue better error message for binary operations between numbers and bigints #28424

Open
DanielRosenwasser opened this issue Nov 9, 2018 · 2 comments
Labels
Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Milestone

Comments

@DanielRosenwasser
Copy link
Member

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.

@weswigham
Copy link
Member

weswigham commented Nov 9, 2018

For the non-assignments: "Operator '{0}' cannot be applied to types '{1}' and '{2}'". Consider wrapping the '{3}' side of the operator with a call to 'BigInt'.?

@weswigham weswigham added Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements labels Nov 9, 2018
@RyanCavanaugh RyanCavanaugh added the Suggestion An idea for TypeScript label Mar 7, 2019
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Aug 16, 2019
@m-henderson
Copy link

@DanielRosenwasser @weswigham did you guys decide on what you would like the diagnostics message to say?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants