Skip to content

instanceof Stripe.ErrorType.StripeError passes type check but throws at runtime #2661

@egorFiNE

Description

@egorFiNE

Describe the bug

Unsure how to catch Stripe errors in catch(err: any) {... }.

To Reproduce

Before (v21):

} catch (e: any) {
  if (e instanceof Stripe.ErrorType && e.statusCode === 404) {
    // ... 
  }
}

Now this code triggers a ts error because obviously. I'm using TS 6.0.

Expected behavior

Not sure what would the correct way of separating Stripe Error instances from others in the update type system.

Code snippets

OS

doesn't matter

Node version

doesn't matter

Library version

v22.0.0

API version

2026-03-25.dahlia

Additional context

With a slim hope that management sees this feedback:

Stop it, just stop. I feel like every new Stripe SDK release lately brings unwelcome and breaking changes and more useless work that brings zero value to anyone involved except Stripe's developers.

Stripe started as a product for developers to eliminate frustration and reduce friction.

Now Stripe is itself a source of frustration since each new SDK version (since about v17) adds friction.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions