UNPKG

@chasemoskal/magical

Version:

web toolkit for lit apps

22 lines (17 loc) 411 B
import {Constructor} from "../toolbox/handy-types.js" export function mixinContextRequirement<xContext>() { return function<C extends Constructor>(Base: C) { return class extends Base { static withContext(context: xContext) { return class extends this { get context() { return context } } } get context(): xContext { throw new Error("context required") } } } }