error TS2583: Cannot find name ‘BigInt’. Do you need to change your target library? Try changing the ‘lib’ compiler option to ‘es2020’ or later.
Broken Code ❌
tsconfig.json
1 2 3 4 5 6 7
{ "compilerOptions":{ "lib":[ "dom" ] } }
ImmortalPerson.ts
1 2 3
typeImmortalPerson = { age: BigInt; }
Fixed Code ✔️
Arbitrary-precision integers (BigInt) were introduced in 11th edition of the ECMAScript Language Specification (ES11 / ES2020), so you have to add this information to the “lib” property of your TypeScript configuration to make use of this API: