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

TS2363: Error arithmetic operation while using Number object #48762

Closed
vicmarcal opened this issue Apr 19, 2022 · 3 comments
Closed

TS2363: Error arithmetic operation while using Number object #48762

vicmarcal opened this issue Apr 19, 2022 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@vicmarcal
Copy link

Bug Report

Typescript is reporting an error when trying to perform an arithmetic operation between a "number" - "Number".

πŸ”Ž Search Terms

TS2363 , Number

πŸ•— Version & Regression Information

Happens in Playground

⏯ Playground Link

[Playground link with relevant code](https://www.typescriptlang.org/play?#code/PTAEFkE9QYwewCYFNQHM5IM6gBZIE5JA)

πŸ’» Code

let number1 = 5;
let newNumber = new Number(3);
var result = number1 + newNumber

πŸ™ Actual behavior

It is preventing to use a sum with a Number

πŸ™‚ Expected behavior

It should probably let to perform a sum with the Number

@MartinJohns
Copy link
Contributor

MartinJohns commented Apr 19, 2022

IMO TypeScript is protecting you from doing something silly like new Number(3).

See #3447.

@RyanCavanaugh
Copy link
Member

See also #2361

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Apr 19, 2022
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants