Skip to content

Commit a6b0706

Browse files
committed
declare FVStore and FVGlobalModels interfaces in types, import and export in index.ts
1 parent 9865f36 commit a6b0706

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import {
2525
ModelSetupContext,
2626
Model,
2727
ModelClone,
28-
Id
28+
Id,
29+
FeathersVuexStoreState,
30+
FeathersVuexGlobalModels
2931
} from './service-module/types'
3032
import { initAuth, hydrateApi } from './utils'
3133
import { FeathersVuex } from './vue-plugin/vue-plugin'
@@ -90,7 +92,7 @@ export default function feathersVuex(feathers, options: FeathersVuexOptions) {
9092
castBaseModel: <T extends {} = {}>() => BaseModel as ModelStatic<T>,
9193
makeAuthPlugin,
9294
FeathersVuex,
93-
models,
95+
models: models as FeathersVuexGlobalModels,
9496
clients
9597
}
9698
}
@@ -115,5 +117,7 @@ export {
115117
ModelClone,
116118
ModelStatic,
117119
ModelSetupContext,
118-
ServiceState
120+
ServiceState,
121+
FeathersVuexGlobalModels,
122+
FeathersVuexStoreState
119123
}

src/service-module/make-base-model.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import {
1010
Model,
1111
ModelStatic,
1212
ModelInstanceClone,
13-
ModelClone
13+
ModelClone,
14+
FeathersVuexGlobalModels,
15+
FeathersVuexStoreState
1416
} from './types'
1517
import { globalModels, prepareAddModel } from './global-models'
1618
import { mergeWithAccessors, checkNamespace, getId, Params } from '../utils'
1719
import _merge from 'lodash/merge'
1820
import _get from 'lodash/get'
1921
import { EventEmitter } from 'events'
20-
import { FeathersVuexStoreState, FeathersVuexGlobalModels } from '..'
2122
import { ModelSetupContext } from './types'
2223
import { Store } from 'vuex'
2324

@@ -56,7 +57,7 @@ export default function makeBaseModel(options: Required<FeathersVuexOptions>) {
5657
const { serverAlias } = options
5758
type D = {}
5859

59-
// If this serverAlias already has a BaseModel, nreturn it
60+
// If this serverAlias already has a BaseModel, return it
6061
const ExistingBaseModel = _get(globalModels, `[${serverAlias}].BaseModel`)
6162
if (ExistingBaseModel) {
6263
return ExistingBaseModel as ModelStatic<D>

src/service-module/types.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Service } from '@feathersjs/feathers'
22
import { Params, Paginated } from '../utils'
33
import { EventEmitter } from 'events'
4-
import { FeathersVuexStoreState, FeathersVuexGlobalModels } from '..'
54
import { Store } from 'vuex'
65

76
export type Id = number | string
@@ -66,19 +65,17 @@ export interface MakeServicePluginOptions {
6665
actions?: {}
6766
}
6867

69-
interface PatchParams<D> extends Params {
70-
data: Partial<D>
68+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
69+
export interface FeathersVuexStoreState {
70+
/** Allow clients to augment store state */
71+
}
72+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
73+
export interface FeathersVuexGlobalModels {
74+
/** Allow clients to augment Global models */
7175
}
7276

73-
declare module '..' {
74-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
75-
interface FeathersVuexStoreState {
76-
/** Allow clients to augment store state */
77-
}
78-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
79-
interface FeathersVuexGlobalModels {
80-
/** Allow clients to augment Global models */
81-
}
77+
interface PatchParams<D> extends Params {
78+
data: Partial<D>
8279
}
8380

8481
export interface ModelSetupContext {

0 commit comments

Comments
 (0)