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

Allow BigInt usage in templates #11126

Open
YanDevDe opened this issue Feb 18, 2020 · 10 comments
Open

Allow BigInt usage in templates #11126

YanDevDe opened this issue Feb 18, 2020 · 10 comments

Comments

@YanDevDe
Copy link

@YanDevDe YanDevDe commented Feb 18, 2020

What problem does this feature solve?

It would allow us to use numbers which is larger than MAX_SAFE_INTEGER.

What does the proposed API look like?

In HTML, {{BigInt("100")}}, {{100n}}, {{2n * 50n}} or {{50n + 50n}} should show "100" (it can be just simply string by using .toString()) at frontend.
At the moment using BigInt in "Mustache" syntax just throw error.
Sure, backup solution would be using external functions or converted into string and save it to variable. But using BigInt directly in HTML would be nice to have.
More Information about BigInt -> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt

@posva posva changed the title BigInt Support? Allow BigInt usage in templates Feb 19, 2020
@posva
Copy link
Member

@posva posva commented Feb 19, 2020

BigInt could be added to the other allowed variables like Number in templates. It will only be supported by browsers supporting it though

@YanDevDe
Copy link
Author

@YanDevDe YanDevDe commented Feb 19, 2020

BigInt has already good (still not large enough, Safari is still missing) cross browser support.
https://caniuse.com/#search=bigint
So perhaps this feature could be implemented as experimental.

@pasDamola
Copy link

@pasDamola pasDamola commented Feb 25, 2020

Hi @posva can i begin working on this? What steps could i take in working on this also.
Thank you

@parthjawale
Copy link

@parthjawale parthjawale commented Feb 26, 2020

Hi @posva, I'd like to work on this issue if that's alright?

@shadowings-zy
Copy link

@shadowings-zy shadowings-zy commented Feb 27, 2020

Hello, I have created a pull request for this feature!
If there are anything wrong in this pull request, I will fix them.

@parthjawale
Copy link

@parthjawale parthjawale commented Feb 27, 2020

Oh, no problem.
Sounds great!

shadowings-zy added a commit to shadowings-zy/vue that referenced this issue Feb 27, 2020
shadowings-zy added a commit to shadowings-zy/vue that referenced this issue Feb 27, 2020
shadowings-zy added a commit to shadowings-zy/vue that referenced this issue Feb 27, 2020
@posva posva added the has PR label Feb 27, 2020
@SuperMan-my
Copy link

@SuperMan-my SuperMan-my commented Jun 3, 2020

果然还是高深莫测

@vuejs vuejs deleted a comment from rohitrajvanhi Jun 17, 2020
@lesleh
Copy link

@lesleh lesleh commented Jun 25, 2020

BigInt has already good (still not large enough, Safari is still missing) cross browser support.

@YanDevDe Safari 14 beta now has BigInt support.

@Hardikanand1st

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
10 participants
You can’t perform that action at this time.