]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: comments, signature
authorEvan You <yyx990803@gmail.com>
Mon, 15 Oct 2018 23:08:19 +0000 (19:08 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 15 Oct 2018 23:08:19 +0000 (19:08 -0400)
packages/core/src/optional/mixin.ts

index 152aba376bbe7d5025317eb12836f8a858c71102..0fbd7fca6b9329c3bff7523fcb40b260683fe868 100644 (file)
@@ -5,6 +5,7 @@ interface ComponentConstructor<This = Component> {
 }
 
 // mind = blown
+// https://stackoverflow.com/questions/50374908/transform-union-type-to-intersection-type
 type UnionToIntersection<U> = (U extends any
   ? (k: U) => void
   : never) extends ((k: infer I) => void)
@@ -15,10 +16,11 @@ type ExtractInstance<T> = T extends (infer U)[]
   ? UnionToIntersection<U extends ComponentConstructor<infer V> ? V : never>
   : never
 
-function mixins<T extends ComponentConstructor[], V = ExtractInstance<T>>(
-  ...args: T
-): ComponentConstructor<V>
-function mixins(...args: any[]): any {
+export function mixins<
+  T extends ComponentConstructor[],
+  V = ExtractInstance<T>
+>(...args: T): ComponentConstructor<V>
+export function mixins(...args: any[]): any {
   // TODO
 }