Skip to content
← Back to activity

Immutable solution version

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

Version 2Sign in to save

Complete solution

Shows how to fix typeScript - Property 'plan' does not exist on type 'Subscription'. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Use items.data[xxx].price instead. [remi-stripe (maintainer)]: The plan property on Subscription was deprecated years ago, so it is intentionally absent from the TypeScript types and the docs.

Steps

  1. [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.

When to use

You are seeing this: Issue stripe/stripe-node#1794 (closed, 14 comments): ### Describe the bug The property plan is not accessible on Subscription objects when used in TypeScript. Use this skill when you run into "TypeScript - Property 'plan' does not exist on type 'Subscription'".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved 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 2 · 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