Bigint' (in lowercase) is a type introduced in ECMAScript 2020 (ES2020) to handle large integers with precision that cannot be accurately represented by the regular 'number' type.
In contrast, 'BigInt' (in uppercase) is the constructor function used to create instances of 'bigint'. It can be found in the global namespace and enables the creation of 'bigint' values using the 'BigInt()' function.
The confusion arises from the fact that both the 'bigint' primitive type and the 'BigInt' constructor function share the same name. Despite this, they are distinct entities and cannot be used interchangeably.
When defining a variable in TypeScript as 'bigint', you are explicitly stating that it should be of type 'bigint'. For instance:
let myNumber: bigint = BigInt(12345);
In the example above, 'myNumber' is specifically declared as a 'bigint' using the lowercase type annotation.
If you use 'BigInt' (uppercase), it refers to the constructor function rather than the primitive type. Attempting to utilize 'BigInt' as a type annotation will result in TypeScript recognizing it as a different type incompatible with 'bigint'. This explains why errors occur when switching the type to 'BigInt'.