question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript compiler cannot find name 'BigInt'

See original GitHub issue

The BigInt type in the Stats.d.ts file causes TypeScript to throw a 2304 (cannot find name) error, so the compilation fails.

TypeScript 2.8.3 memfs 2.14.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mjfreem1commented, Dec 11, 2018

@streamich @pizzafroide Thanks for your responses. I tried out both suggestions and ended up opting to just upgrade TypeScript. C’est la vie.

2reactions
pizzafroidecommented, Dec 10, 2018

You are right: BigInt support was added to TypeScript 3.2, and, unfortunately, they say:

we have no immediate plans to provide downleveling support

However, BigInt support was added to memfs before it was in TypeScript. To make it work, we needed to add BigInt definition ourselves (in bigint.d.ts file). This file is still there. Maybe it could be copied to lib directory at compile time so “old TypeScript” users could import it. @mjfreem1, in the meantime, you can add the following code in some file and import it before importing memfs:

type BigInt = number;
declare const BigInt: typeof Number;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using BigInt in TypeScript - Stack Overflow
ts:1:9 - error TS2304: Cannot find name 'BigInt'. 1 let x = BigInt(123) ~~~~~~ Found 1 error.
Read more >
Unable to run ionic old project: Cannot find name 'bigint'
I am trying to run my old project to modification, I have successfully run npm install but unable to serve the app. It's...
Read more >
Microsoft/TypeScript - Gitter
I believe I should be able to use BigInt now in TypeScript...but changing some code base to use and I get "Cannot find...
Read more >
Documentation - TypeScript 3.2
TypeScript 3.2 introduces a new strictBindCallApply compiler option (in the ... You can get a bigint by calling the BigInt() function or by...
Read more >
Unable to use BigInt in typescript version 3.4.5. Error TS2304 ...
[Solved]-Unable to use BigInt in typescript version 3.4.5. Error TS2304: Cannot find name 'BigInt'-angular.js ... I am able to resolve the error by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found