New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@lit/context
's types conflict with those documented on the context protocol
#4609
Comments
It looks to me like the runtime types are also incorrect, at least according to the context protocol. So this will not just halt the typescript compiler, but will also fail to interoperate in-browser Lit's context request event will have a interface LitContextRequestEvent extends Event {
context: { __context__: unknown }
} but the protocol specifies: interface ProtocolContextEvent extends Event {
context: { name: string, initialValue?: unknown },
} Hoping you can show me how I'm misreading things here |
Related to #4601 |
Thanks for raising this. I'll try your repro locally and see if I find a minimally breaking path forward here. For I think the event type error is cause by the same root problem. I'm not sure how many other implementations of the protocol there are. We could certainly use some conformance tests or at the very least common types file to catch this kind of thing. |
Which package(s) are affected?
Context (@lit/context)
Description
The context protocol offers some types for context events https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md#definitions
In a typescript project where these types are present, installing and importing
@lit/context
will break with this error:Reproduction
ctx.js
element.js
npx tsc
Observe:
Workaround
only use lit's interpretation of context, give up on interop
Is this a regression?
No or unsure. This never worked, or I haven't tried before.
Affected versions
see package.json above
Browser/OS/Node environment
Node: v20.10.0
Typescript and lit: see above package.json
The text was updated successfully, but these errors were encountered: