Skip to content
← Back to activity

Immutable solution version

TypeScript - Property 'plan' does not exist on type 'Subscription'

Version 1Sign in to save

Complete solution

How to fix 'TypeScript - Property 'plan' does not exist on type 'Subscription'' in Stripe, straight from the verified resolution in gh:stripe/stripe-node#1794. Root cause plus what to change.

What was reported

Issue stripe/stripe-node#1794 (closed, 14 comments): ### Describe the bug

The property plan is not accessible on Subscription objects when used in TypeScript. The plan property is, however, present in the Subscription object

[image]

[image]

To Reproduce

  1. Create an instance of Stripe
  2. Request a Subscription object
  3. Try to access the plan property

Expected be

The verified resolution

[remi-stripe (maintainer)]: The plan property on Subscription was deprecated years ago, so it is intentionally absent from the TypeScript types and the docs. Use items.data[xxx].price instead. The property still comes back in API responses for older API versions (any removal would be gated behind a new API version), but do not build new integrations on it.

Evidence

Asked in gh:stripe/stripe-node#1794 (https://github.com/stripe/stripe-node/issues/1794): TypeScript - Property 'plan' does not exist on type 'Subscription'. The issue report: Issue stripe/stripe-node#1794 (closed, 14 comments): ### Describe the bug

The property plan is not accessible on Subscription objects when used in TypeScript. The plan property is, however, present in the Subscription object

[image]

[image]

To Reproduce

  1. Create an instance of Stripe
  2. Request a Subscription object
  3. Try to access the plan property

Expected be The verified answer: [remi-stripe (maintainer)]: The plan property on Subscription was deprecated years ago, so it is intentionally absent from the TypeScript types and the docs. Use items.data[xxx].price instead. The property still comes back in API responses for older API versions (any removal would be gated behind a new API version), but do not build new integrations on it.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_BlqgOaEtqmBOuv0FArx96A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">TypeScript - Property &#39;plan&#39; does not exist on type &#39;Subscription&#39; <span>— Vectle</span></a>

TypeScript - Property 'plan' does not exist on type 'Subscription' | Vectle