Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe TypeScript types affecting tsc build performance? #845

Open
lensbart opened this issue Mar 22, 2020 · 5 comments
Open

Stripe TypeScript types affecting tsc build performance? #845

lensbart opened this issue Mar 22, 2020 · 5 comments
Labels

Comments

@lensbart
Copy link

lensbart commented Mar 22, 2020

Posted as a question on Stack Overflow before

Since our TypeScript build was taking longer than expected for initial builds, I included incremental: true in tsconfig.json so that a tsconfig.tsbuildinfo would be created which would drastically shorten the initial build time of tsc --watch.

Upon inspection, the file contains 19999+ occurrences of the word stripe, in the form of:

      "./app/enums/licensetype.ts": [
        "./node_modules/@types/node/fs.d.ts",
        "./node_modules/@types/node/ts3.2/fs.d.ts",
        "./node_modules/@types/node/util.d.ts",
        "./node_modules/@types/node/ts3.2/util.d.ts",
        "./node_modules/stripe/types/shared.d.ts",
        "./node_modules/stripe/types/webhooks.d.ts",
        "./node_modules/stripe/types/oauth.d.ts",
        "./node_modules/stripe/types/2020-03-02/accounts.d.ts",
        "./node_modules/stripe/types/2020-03-02/accountlinks.d.ts",
        "./node_modules/stripe/types/2020-03-02/alipayaccounts.d.ts",
        "./node_modules/stripe/types/2020-03-02/applepaydomains.d.ts",
        "./node_modules/stripe/types/2020-03-02/applications.d.ts",
        "./node_modules/stripe/types/2020-03-02/applicationfees.d.ts",
        "./node_modules/stripe/types/2020-03-02/balance.d.ts",
        "./node_modules/stripe/types/2020-03-02/balancetransactions.d.ts",
        "./node_modules/stripe/types/2020-03-02/bankaccounts.d.ts",
        "./node_modules/stripe/types/2020-03-02/bitcoinreceivers.d.ts",
        "./node_modules/stripe/types/2020-03-02/cards.d.ts",
        "./node_modules/stripe/types/2020-03-02/charges.d.ts",
        "./node_modules/stripe/types/2020-03-02/checkout/sessions.d.ts",
        "./node_modules/stripe/types/2020-03-02/connectcollectiontransfers.d.ts",
        "./node_modules/stripe/types/2020-03-02/countryspecs.d.ts",
        "./node_modules/stripe/types/2020-03-02/coupons.d.ts",
        "./node_modules/stripe/types/2020-03-02/creditnotes.d.ts",
        "./node_modules/stripe/types/2020-03-02/customers.d.ts",
        "./node_modules/stripe/types/2020-03-02/discounts.d.ts",
        "./node_modules/stripe/types/2020-03-02/disputes.d.ts",
        "./node_modules/stripe/types/2020-03-02/ephemeralkeys.d.ts",
        "./node_modules/stripe/types/2020-03-02/events.d.ts",
        "./node_modules/stripe/types/2020-03-02/exchangerates.d.ts",
        "./node_modules/stripe/types/2020-03-02/files.d.ts",
        "./node_modules/stripe/types/2020-03-02/filelinks.d.ts",
        "./node_modules/stripe/types/2020-03-02/invoices.d.ts",
        "./node_modules/stripe/types/2020-03-02/invoiceitems.d.ts",
        "./node_modules/stripe/types/2020-03-02/issuerfraudrecords.d.ts",
        "./node_modules/stripe/types/2020-03-02/issuing/authorizations.d.ts",
        "./node_modules/stripe/types/2020-03-02/issuing/cards.d.ts",
        "./node_modules/stripe/types/2020-03-02/issuing/carddetails.d.ts",
        "./node_modules/stripe/types/2020-03-02/issuing/cardholders.d.ts",
        "./node_modules/stripe/types/2020-03-02/issuing/disputes.d.ts",
        "./node_modules/stripe/types/2020-03-02/issuing/transactions.d.ts",
        "./node_modules/stripe/types/2020-03-02/mandates.d.ts",
        "./node_modules/stripe/types/2020-03-02/orders.d.ts",
        "./node_modules/stripe/types/2020-03-02/orderitems.d.ts",
        "./node_modules/stripe/types/2020-03-02/orderreturns.d.ts",
        "./node_modules/stripe/types/2020-03-02/paymentintents.d.ts",
        "./node_modules/stripe/types/2020-03-02/paymentmethods.d.ts",
        "./node_modules/stripe/types/2020-03-02/payouts.d.ts",
        "./node_modules/stripe/types/2020-03-02/plans.d.ts",
        "./node_modules/stripe/types/2020-03-02/platformtaxfees.d.ts",
        "./node_modules/stripe/types/2020-03-02/products.d.ts",
        "./node_modules/stripe/types/2020-03-02/radar/earlyfraudwarnings.d.ts",
        "./node_modules/stripe/types/2020-03-02/radar/valuelists.d.ts",
        "./node_modules/stripe/types/2020-03-02/radar/valuelistitems.d.ts",
        "./node_modules/stripe/types/2020-03-02/recipients.d.ts",
        "./node_modules/stripe/types/2020-03-02/refunds.d.ts",
        "./node_modules/stripe/types/2020-03-02/reporting/reportruns.d.ts",
        "./node_modules/stripe/types/2020-03-02/reporting/reporttypes.d.ts",
        "./node_modules/stripe/types/2020-03-02/reservetransactions.d.ts",
        "./node_modules/stripe/types/2020-03-02/reviews.d.ts",
        "./node_modules/stripe/types/2020-03-02/sigma/scheduledqueryruns.d.ts",
        "./node_modules/stripe/types/2020-03-02/setupintents.d.ts",
        "./node_modules/stripe/types/2020-03-02/skus.d.ts",
        "./node_modules/stripe/types/2020-03-02/sources.d.ts",
        "./node_modules/stripe/types/2020-03-02/sourcemandatenotifications.d.ts",
        "./node_modules/stripe/types/2020-03-02/sourcetransactions.d.ts",
        "./node_modules/stripe/types/2020-03-02/subscriptions.d.ts",
        "./node_modules/stripe/types/2020-03-02/subscriptionitems.d.ts",
        "./node_modules/stripe/types/2020-03-02/subscriptionschedules.d.ts",
        "./node_modules/stripe/types/2020-03-02/taxdeductedatsources.d.ts",
        "./node_modules/stripe/types/2020-03-02/taxrates.d.ts",
        "./node_modules/stripe/types/2020-03-02/terminal/connectiontokens.d.ts",
        "./node_modules/stripe/types/2020-03-02/terminal/locations.d.ts",
        "./node_modules/stripe/types/2020-03-02/terminal/readers.d.ts",
        "./node_modules/stripe/types/2020-03-02/tokens.d.ts",
        "./node_modules/stripe/types/2020-03-02/topups.d.ts",
        "./node_modules/stripe/types/2020-03-02/transfers.d.ts",
        "./node_modules/stripe/types/2020-03-02/webhookendpoints.d.ts",
        "./node_modules/stripe/types/2020-03-02/capabilities.d.ts",
        "./node_modules/stripe/types/2020-03-02/externalaccounts.d.ts",
        "./node_modules/stripe/types/2020-03-02/loginlinks.d.ts",
        "./node_modules/stripe/types/2020-03-02/persons.d.ts",
        "./node_modules/stripe/types/2020-03-02/feerefunds.d.ts",
        "./node_modules/stripe/types/2020-03-02/bitcointransactions.d.ts",
        "./node_modules/stripe/types/2020-03-02/creditnotelineitems.d.ts",
        "./node_modules/stripe/types/2020-03-02/customerbalancetransactions.d.ts",
        "./node_modules/stripe/types/2020-03-02/customersources.d.ts",
        "./node_modules/stripe/types/2020-03-02/taxids.d.ts",
        "./node_modules/stripe/types/2020-03-02/invoicelineitems.d.ts",
        "./node_modules/stripe/types/2020-03-02/usagerecords.d.ts",
        "./node_modules/stripe/types/2020-03-02/usagerecordsummaries.d.ts",
        "./node_modules/stripe/types/2020-03-02/transferreversals.d.ts",
        "./node_modules/stripe/types/2020-03-02/index.d.ts",
        "./node_modules/stripe/types/lib.d.ts"
      ],

Where ./app/enums/licensetype.ts (the key) is a file in our codebase and the string values in the array are presumably the types that are loaded in memory for this file?

I’m quite surprised by this, because we use the Stripe NPM module in just a couple of files, and none of our other ~90 dependencies occur in this list. tsconfig.tsbuildinfo is 388k lines, which seems a bit on the high side, especially because most of these lines are the Stripe types listed above.

How can I optimise my TypeScript configuration such that Stripe doesn’t slow down our build?

Many thanks in advance.

  • node v12.16.1
  • typescript 3.8.3
  • stripe 8.33.0
@rattrayalex-stripe
Copy link
Contributor

Hi @lensbart ,

Thanks for sharing this. I'll look into whether we can do anything on our side about tsconfig.tsbuildinfo bloat. However, I'm curious whether this amount of data in that file causes build speed issues for you?

I believe you might be able to investigate this by commenting out your usages of stripe, and seeing if your build (incremental and initial) are slower or faster? The time utility on linux/mac may be handy for this.

@csojinb
Copy link

csojinb commented May 19, 2020

I am also having issues with my TS build getting much slower on upgrade to v8

@tbillington
Copy link

Having this issue too. Ideally we'd be able to just import what we need, for example import { Charge } from 'stripe';.

Unfortunately we rely on packages that include stripe so we don't have direct control over this.

@maxdeviant
Copy link

We're also seeing very long compile times after adding the stripe package to our project. I have yet to see it finish compiling if we reference anything from stripe.

Commenting out the import Stripe from 'stripe'; line causes the slowness to disappear.

@maxdeviant
Copy link

Some more info: it looks like we are using "incremental": true in our tsconfig.json. Changing it to "incremental": false seemed to fix the problem.

I just purged the tsconfig.buildinfo and built again with incremental enabled and now it seems to be building fine.

I would suggest anyone experiencing issues try deleting your tsconfig.buildinfo and retrying if you're using incremental mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants