From be95ad00e9c73fa29e14c2aaf7006bba723d3b14 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 15 Oct 2018 19:08:19 -0400 Subject: [PATCH] chore: comments, signature --- packages/core/src/optional/mixin.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/core/src/optional/mixin.ts b/packages/core/src/optional/mixin.ts index 152aba37..0fbd7fca 100644 --- a/packages/core/src/optional/mixin.ts +++ b/packages/core/src/optional/mixin.ts @@ -5,6 +5,7 @@ interface ComponentConstructor { } // mind = blown +// https://stackoverflow.com/questions/50374908/transform-union-type-to-intersection-type type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) @@ -15,10 +16,11 @@ type ExtractInstance = T extends (infer U)[] ? UnionToIntersection ? V : never> : never -function mixins>( - ...args: T -): ComponentConstructor -function mixins(...args: any[]): any { +export function mixins< + T extends ComponentConstructor[], + V = ExtractInstance +>(...args: T): ComponentConstructor +export function mixins(...args: any[]): any { // TODO }