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
{
  "compilerOptions": {
    "lib": ["dom"]
  }
}
ImmortalPerson.ts
type ImmortalPerson = {
  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:

tsconfig.json
{
  "compilerOptions": {
    "lib": ["dom", "es2020.bigint"]
  }
}

Alternatively, you can make all additional APIs from ES2020 available to your code:

tsconfig.json
{
  "compilerOptions": {
    "lib": ["dom", "es2020"]
  }
}