Support BigInt literals

Currently when you use BigInt literals, runkit will give you an syntax error: Identifier directly after number (1:1)

It is possible to workaround this issue with eval or by using the BigInt constructor but it would be nice to have this feature built into runkit.

BigInts are available in Node 10.4 and higher.

And the result field only shows BigInt {} instead of the value.

Can you give us a screenshot, code or a way to reproduce this error?

You can reproduce the bug like this:

// This works:
const myBinInt = BigInt(5);
// This causes a syntax error in the editor: (Identifier directly after number)
const otherBigInt = 5n;
// The version of node RunKit uses supports it, as evidenced by this eval statement:
const anotherBigInt = eval('5n');

So this error is likely from the checks being done on the code before it is even sent to the server.

If you’re using Babel to parse the code, this plugin can be used to add support for BigInt literals:

1 Like