Skip to content

Instantly share code, notes, and snippets.

@heyMP
Created November 23, 2022 16:52
Show Gist options
  • Save heyMP/b277e5fdbe491d8bb0c6b89097520121 to your computer and use it in GitHub Desktop.
Save heyMP/b277e5fdbe491d8bb0c6b89097520121 to your computer and use it in GitHub Desktop.
import * as C from '@lit-labs/context';
class S<T extends C.ContextKey<unknown, unknown>> {
constructor(
public host: HTMLElement,
public context: T,
public provider: C.ContextType<T>,
) {}
}
interface P {
hi: 'there'
}
const el = new HTMLElement();
const c = C.createContext<P>('hi');
const s = new S(el, c, {});
s.provider.hi;
const d = C.createContext<number>('there');
new S(el, d, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment