[context] Expose Options types for ContextConsumer and ContextProvider#5340
[context] Expose Options types for ContextConsumer and ContextProvider#5340adv0r wants to merge 1 commit into
Conversation
…ovider` Re-export the `Options` interfaces from the context consumer and provider controllers from `@lit/context`'s public entry point, under distinct names to avoid the collision between the two same-named interfaces: - `ContextConsumerOptions` (re-exported from `./controllers/context-consumer.js`) - `ContextProviderOptions` (re-exported from `./controllers/context-provider.js`) These types were already public on the controller constructor signatures, but could not be referenced from user code because `ConstructorParameters<typeof ContextConsumer>` does not see through the deprecated constructor overload. Includes a changeset for `@lit/context` (patch). Fixes lit#4837 Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: a35b591 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Noted the CLA check — Google CLA is being signed under @adv0r and the check should turn green once the bot picks it up. Will leave a follow-up here if anything else is needed from my side. (Tangentially: per AGENTS.md / CONTRIBUTING this PR is AI-generated under a personal token-burn initiative, see PR body for details. Happy to revise on review.) |
Summary
Re-export the
Optionsinterfaces from@lit/context's public entrypoint so that user code wrapping
ContextConsumer/ContextProvidercan reference them without having to copy-paste their definitions.
Adds the following named re-exports from
packages/context/src/index.ts:ContextConsumerOptions— alias for theOptionsinterface in./lib/controllers/context-consumer.jsContextProviderOptions— alias for theOptionsinterface in./lib/controllers/context-provider.jsAliases are needed because both source modules export a type named
Options; the new public names make their package origin obvious andlet both be imported from the same entry point.
Also adds a changeset for
@lit/context(patch).Fixes #4837
Why
The two
Optionsinterfaces are part of the public constructorsignatures of
ContextConsumer/ContextProvider, but they werenot reachable from
@lit/context.ConstructorParameters<typeof X>cannot extract them because of the deprecated constructor overload on
each controller. The only workaround today is to copy-paste the type
definitions into user code (see the issue for a concrete wrapper /
lazy-loading use case).
Backward compatibility
Type-only, additive change. No runtime behavior changes; existing
imports are untouched.
AI disclosure
Per AGENTS.md / CONTRIBUTING — this is a small AI-generated, unattended
contribution made by a Cursor Anthropic Claude Opus 4.7 agent under
@adv0r as a short personal token-burn initiative before my Cursor
subscription billing cycle ends. Happy to iterate on review.
Made with Cursor