import Vue, {WatchOptions, VueConstructor} from 'vue' import { ThisTypedComponentOptionsWithArrayProps, ThisTypedComponentOptionsWithRecordProps, } from 'vue/types/options' import {ExtendedVue} from 'vue/types/vue' import {Scope, Store, Unit} from 'effector' type Inference = EffectorState extends Store ? State : EffectorState extends {[storeName: string]: Store} ? { [K in keyof EffectorState]: EffectorState[K] extends Store ? U : never } : EffectorState extends Unit ? number : never type EffectorType = | Store | {[key: string]: Store | Unit} | (() => Store | Unit) type ExpandType< V extends Vue, EffectorState extends EffectorType, > = EffectorState extends | ((this: V) => Store | Unit) | Store | Unit ? {state: State} : EffectorState extends {[storeName: string]: Store | Unit} ? {[Key in keyof EffectorState]: Inference} : never declare module 'vue/types/vue' { interface Vue { $watchAsStore: typeof watchAsStore $store: typeof store } interface VueConstructor { extend< EffectorState extends EffectorType, Data, Methods, Computed, PropNames extends string = never, >( options?: { effector?: EffectorState } & ThisTypedComponentOptionsWithArrayProps< ExpandType & V, Data, Methods, Computed, PropNames >, ): ExtendedVue< ExpandType & V, Data, Methods, Computed, Record > extend( options?: { effector?: EffectorState } & ThisTypedComponentOptionsWithRecordProps< ExpandType & V, Data, Methods, Computed, Props >, ): ExtendedVue< ExpandType & V, Data, Methods, Computed, Props > } } declare module 'vue/types/options' { interface ComponentOptions { effector?: EffectorType } } declare function watchAsStore( exp: string, options?: WatchOptions, ): Store<{oldValue: State; newValue: State}> declare function watchAsStore( fn: () => State, options?: WatchOptions, ): Store<{oldValue: State; newValue: State}> declare function store(exp: string): Store declare function store(fn: () => State): Store declare function VueEffector(vm: VueConstructor, options?: Object): void declare function createComponent( options: ThisTypedComponentOptionsWithRecordProps< V, Data, Methods, Computed, Props >, ): ExtendedVue declare function createComponent< V extends Vue, Data, Methods, Computed, PropNames extends string, >( options: ThisTypedComponentOptionsWithArrayProps< V, Data, Methods, Computed, PropNames >, ): ExtendedVue declare function createComponent< S extends {[field: string]: Store | Unit}, V extends Vue, Data, Methods, Computed, Props, >( options: ThisTypedComponentOptionsWithRecordProps< Inference & V, Data, Methods, Computed, Props >, store?: S, ): ExtendedVue & V, Data, Methods, Computed, Props> declare function createComponent< S extends {[field: string]: Store | Unit}, V extends Vue, Data, Methods, Computed, PropNames extends string, >( options: ThisTypedComponentOptionsWithArrayProps< Inference & V, Data, Methods, Computed, PropNames >, store?: S, ): ExtendedVue & V, Data, Methods, Computed, PropNames> export function EffectorScopePlugin(config: { scope: Scope scopeName?: string }): Plugin