Skip to content

docs: add JSDoc to WhereCell and improve Stripe plugin typings - #17722

Open
NitinSemwal2605 wants to merge 1 commit into
payloadcms:mainfrom
NitinSemwal2605:fix/jsdoc-and-typings
Open

docs: add JSDoc to WhereCell and improve Stripe plugin typings#17722
NitinSemwal2605 wants to merge 1 commit into
payloadcms:mainfrom
NitinSemwal2605:fix/jsdoc-and-typings

Conversation

@NitinSemwal2605

Copy link
Copy Markdown

docs: add JSDoc to WhereCell and improve Stripe plugin typings

Which branch should this PR target?

  • main

What?

This PR resolves a couple of incomplete documentation and typing issues in the codebase marked with @todo / TODO.

  1. packages/ui: Adds a comprehensive JSDoc block to transformWhereToNaturalLanguage and QueryPresetsWhereCell, replacing a vague /** @todo: improve this */.
  2. packages/plugin-stripe: Improves typings and adds JSDoc to all exported types in types.ts. Specifically, it derives stripeResourceType directly from the Stripe SDK instead of a hardcoded union ('customers' | 'products'), and computes stripeResourceTypeSingular from the former so the two cannot go out of sync.

Why?

  • Proper JSDoc improves the developer experience by surfacing parameter signatures, examples, and known limitations (such as transformWhereToNaturalLanguage currently only reading the first condition) in the IDE.
  • Tying the Stripe resource types directly to the Stripe SDK (keyof Pick<Stripe, ...>) eliminates the need to manually update static union types if new resource types are supported in the future. Deriving the singular mapping via a utility type ensures the plural/singular counterparts never drift apart.

How?

In packages/ui/.../WhereCell/index.tsx:

  • Replaced the single-line @todo with a full JSDoc block detailing the function's parameters, return values, an example, and a note about its current limitations.

In packages/plugin-stripe/src/types.ts:

  • Added a StripeResourceSingularMap mapping plural keys to singular string literals.
  • Updated stripeResourceType to keyof Pick<Stripe, 'customers' | 'products'>.
  • Updated stripeResourceTypeSingular to look up the singular form from the map using stripeResourceType.
  • Added JSDoc blocks explaining each property in SyncConfig, StripePluginConfig, and others.

Fixes #

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant