44 * SPDX-License-Identifier: BSD-3-Clause
55 */
66
7- import { ContextType , ContextKey } from './context-key .js' ;
7+ import { ContextType , Context } from './create-context .js' ;
88
99declare global {
1010 interface HTMLElementEventMap {
1111 /**
1212 * A 'context-request' event can be emitted by any element which desires
1313 * a context value to be injected by an external provider.
1414 */
15- 'context-request' : ContextRequestEvent < ContextKey < unknown , unknown > > ;
15+ 'context-request' : ContextRequestEvent < Context < unknown , unknown > > ;
1616 }
1717}
1818
@@ -28,9 +28,9 @@ export type ContextCallback<ValueType> = (
2828/**
2929 * Interface definition for a ContextRequest
3030 */
31- export interface ContextRequest < Context extends ContextKey < unknown , unknown > > {
32- readonly context : Context ;
33- readonly callback : ContextCallback < ContextType < Context > > ;
31+ export interface ContextRequest < C extends Context < unknown , unknown > > {
32+ readonly context : C ;
33+ readonly callback : ContextCallback < ContextType < C > > ;
3434 readonly subscribe ?: boolean ;
3535}
3636
@@ -47,9 +47,9 @@ export interface ContextRequest<Context extends ContextKey<unknown, unknown>> {
4747 * If no `subscribe` value is present in the event, then the provider can assume that this is a 'one time'
4848 * request for the context and can therefore not track the consumer.
4949 */
50- export class ContextRequestEvent < Context extends ContextKey < unknown , unknown > >
50+ export class ContextRequestEvent < C extends Context < unknown , unknown > >
5151 extends Event
52- implements ContextRequest < Context >
52+ implements ContextRequest < C >
5353{
5454 /**
5555 *
@@ -58,8 +58,8 @@ export class ContextRequestEvent<Context extends ContextKey<unknown, unknown>>
5858 * @param subscribe an optional argument, if true indicates we want to subscribe to future updates
5959 */
6060 public constructor (
61- public readonly context : Context ,
62- public readonly callback : ContextCallback < ContextType < Context > > ,
61+ public readonly context : C ,
62+ public readonly callback : ContextCallback < ContextType < C > > ,
6363 public readonly subscribe ?: boolean
6464 ) {
6565 super ( 'context-request' , { bubbles : true , composed : true } ) ;
0 commit comments