@sandlada/mdc
Version:
@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.
18 lines • 940 B
TypeScript
/**
* @license
* Copyright 2025 Kai-Orion & Sandlada
* SPDX-License-Identifier: MIT
*/
import type { MixinBase, MixinReturn } from '../behaviors/mixin';
type AnyMixin = (base: MixinBase<any>) => MixinReturn<any, any>;
type ExtractMixinInstanceType<T extends AnyMixin> = InstanceType<ReturnType<T>>;
type IntersectTuple<T extends any[]> = T extends [infer First, ...infer Rest] ? First & IntersectTuple<Rest> : {};
type ExtractMixinInstanceTypes<T extends any[]> = {
[K in keyof T]: ExtractMixinInstanceType<T[K]>;
};
type ComposedClass<Base extends MixinBase, Mixins extends any[]> = Omit<Base, 'prototype'> & {
new (...args: ConstructorParameters<Base>): InstanceType<Base> & IntersectTuple<ExtractMixinInstanceTypes<Mixins>>;
};
export declare function composeMixin<T extends AnyMixin[]>(...mixins: T): <Base extends MixinBase>(baseClass: Base) => ComposedClass<Base, T>;
export {};
//# sourceMappingURL=compose-mixin.d.ts.map