update(types): Remove unnecessary type exports

* rename StringFunc for better understanding
This commit is contained in:
Braks
2022-04-04 21:42:48 +02:00
parent 55588c3988
commit ade61ca2e1
10 changed files with 101 additions and 109 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { EmitFunc, FlowHooks, FlowEvents } from '~/types'
import { EmitFunc, FlowHooks } from '~/types'
// flow event hooks
export const createHooks = (): FlowHooks => ({
@@ -41,7 +41,7 @@ export const createHooks = (): FlowHooks => ({
const bind = (emit: EmitFunc, hooks: FlowHooks) => {
for (const [key, value] of Object.entries(hooks)) {
value.on((data: FlowEvents[keyof FlowHooks]) => {
value.on((data) => {
emit(key as keyof FlowHooks, data)
})
}
+3 -4
View File
@@ -1,7 +1,7 @@
import useState from './state'
import useActions from './actions'
import useGetters from './getters'
import { FlowHook, FlowHooksOn, FlowOptions, Store, State } from '~/types'
import { FlowHooksOn, FlowOptions, Store, State } from '~/types'
export default (preloadedState?: FlowOptions): Store => {
const state: State = useState(preloadedState)
@@ -10,8 +10,8 @@ export default (preloadedState?: FlowOptions): Store => {
const actions = useActions(reactiveState, getters)
const hooksOn: FlowHooksOn = <any>{}
Object.entries(reactiveState.hooks).forEach(([n, h]) => {
const name = `on${n.charAt(0).toUpperCase() + n.slice(1)}`
hooksOn[<keyof FlowHooksOn>name] = h.on as FlowHook['on']
const name = `on${n.charAt(0).toUpperCase() + n.slice(1)}` as keyof FlowHooksOn
hooksOn[name] = h.on as any
})
actions.setState(reactiveState)
if (preloadedState) {
@@ -21,7 +21,6 @@ export default (preloadedState?: FlowOptions): Store => {
}
return reactive({
state: reactiveState,
...hooksOn,
...toRefs(reactiveState),
...getters,