I believe I should be able to use BigInt now in TypeScript...but changing some code base to use it and I get \"Cannot find name \'BigInt\'. (2304)\" any thought on why I am
BigInt
support has been added on TypeScript 3.2; make sure your version is compatible.
But on top of that, you need to decide how BigInt
will be supported on the context of your script - will you provide polyfills, or will you only run your script on environments that are guaranteed to have BigInt
support?
This means you will need esnext as your build target (likely on tsconfig.json
's target
field), since BigInt
is not compatible with previous ECMAScript versions.
If you do include a BigInt
polyfill, you can use esnext.bigint
as part of the lib
field during transpilation. This adds the needed definitions to the process.