Skip to content

[context] Expose Options types for ContextConsumer and ContextProvider#5340

Open
adv0r wants to merge 1 commit into
lit:mainfrom
adv0r:tokenburn/context-expose-options-types
Open

[context] Expose Options types for ContextConsumer and ContextProvider#5340
adv0r wants to merge 1 commit into
lit:mainfrom
adv0r:tokenburn/context-expose-options-types

Conversation

@adv0r

@adv0r adv0r commented May 20, 2026

Copy link
Copy Markdown

Dear maintainer — this PR has a permanent home with methodology + opt-out at tokens-for-good. A one-line "no thanks" → auto-close + blacklist. Sorry for the notification this edit caused.


Summary

Re-export the Options interfaces from @lit/context's public entry
point so that user code wrapping ContextConsumer / ContextProvider
can reference them without having to copy-paste their definitions.

Adds the following named re-exports from packages/context/src/index.ts:

  • ContextConsumerOptions — alias for the Options interface in
    ./lib/controllers/context-consumer.js
  • ContextProviderOptions — alias for the Options interface in
    ./lib/controllers/context-provider.js

Aliases are needed because both source modules export a type named
Options; the new public names make their package origin obvious and
let both be imported from the same entry point.

Also adds a changeset for @lit/context (patch).

Fixes #4837

Why

The two Options interfaces are part of the public constructor
signatures of ContextConsumer / ContextProvider, but they were
not 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

…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>
@adv0r adv0r requested a review from kevinpschaaf as a code owner May 20, 2026 13:58
@changeset-bot

changeset-bot Bot commented May 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a35b591

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lit/context Patch

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

@google-cla

google-cla Bot commented May 20, 2026

Copy link
Copy Markdown

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.

@adv0r

adv0r commented May 20, 2026

Copy link
Copy Markdown
Author

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.)

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.

[context] Expose "Options" types

1 participant