Stripe typescript error (ionic v3)

I have an Ionic V3 app that I publish as a PWA.

I want to save card information using Firebase as backend (node.js).

When I install Stripe using npm install -save stripe (installs the latest version) and build my app, I get a bunch of typescript errors and the build fails.

The versions of various packages in my app:
“ionic-angular”: “3.9.2”,
“firebase”: “^4.12.1”
“typescript”: “~2.6.2”
“rxjs”: “5.5.11”,
“angularfire2”: “^5.0.0-rc.6”,
“devDependencies”: {
@ionic/app-scripts”: “3.1.11”,
“typescript”: “~2.6.2”
“engines”: {
“node”: “8”

I know these versions are old but I have other dependencies that forces me to keep these versions. I can get everything else working well except Stripe’s latest version.

The error messages I get are such as:

[16:00:54]  typescript: node_modules/@types/node/globals.d.ts, line: 261 
            Cannot find name 'bigint'. 

     L260:  writeBigUInt64BE(value: bigint, offset?: number): number;
     L261:  writeBigUInt64LE(value: bigint, offset?: number): number;
     L262:  writeUIntLE(value: number, offset: number, byteLength: number): number;
[16:00:54]  typescript: node_modules/@types/node/fs.d.ts, line: 80 
            Cannot find name 'AsyncIterableIterator'. 

      L80:          [Symbol.asyncIterator](): AsyncIterableIterator<Dirent>;

[16:00:54]  typescript: node_modules/@types/node/fs.d.ts, line: 2222 
            Cannot find name 'bigint'. 

    L2222:      export interface BigIntStats extends StatsBase<bigint> {

[16:00:54]  typescript: node_modules/@types/node/events.d.ts, line: 55 
            Cannot find name 'symbol'. 

      L55:      static readonly errorMonitor: unique symbol;

The errors are completely gone and app builds perfectly if I uninstall stripe. What can I do to solve this problem? I have to complete this app soon and do not have time to update everything to the latest versions.

Thank you

Sadly I think you’ve answered your own question. symbol was added in TypeScript 2.7, and bigint was added in TypeScript 3.2.

1 Like

Then maybe I should try to get the other things working with a higher version of typescript. Some trial and error.

I would be very surprised to hear that you were able to bump TypeScript much past 2.6.2 with an ionic/angular project, especially not all the way to 3.2.

Realistically, I think if you want to incorporate this version of the stripe library, you are going to need to rewrite this app as a straight “angular” (aka the current version (5.x at time of writing) of Ionic Framework) app.

If you don’t want to do that, I think your best option is to hunt for an old Stripe library version and use that instead.