Skip to content

Commit b36ea1f

Browse files
committed
allow untyped BaseModel to still access any model props
1 parent a6b0706 commit b36ea1f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/service-module/types.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,20 @@ export interface ModelInstanceOptions {
110110
merge?: boolean
111111
}
112112

113+
type AnyData = { [k: string]: any }
114+
113115
/**
114116
* FeathersVuex Model with readonly data props
115117
*/
116-
export type Model<D extends {} = {}> = ModelInstance<D> & Readonly<D>
118+
export type Model<D extends {} = AnyData> = ModelInstance<D> & Readonly<D>
117119

118120
/**
119121
* FeathersVuex Model clone with writeable data props
120122
*/
121-
export type ModelClone<D extends {} = {}> = ModelInstanceClone<D> & D
123+
export type ModelClone<D extends {} = AnyData> = ModelInstanceClone<D> & D
122124

123125
/** Static Model interface */
124-
export interface ModelStatic<D extends {} = {}> extends EventEmitter {
126+
export interface ModelStatic<D extends {} = AnyData> extends EventEmitter {
125127
/**
126128
* The path passed to `FeathersClient.service()` to create the service
127129
*/
@@ -235,7 +237,7 @@ export interface ModelStatic<D extends {} = {}> extends EventEmitter {
235237
}
236238

237239
/** Model instance interface */
238-
export interface ModelInstance<D extends {} = {}> {
240+
export interface ModelInstance<D extends {} = AnyData> {
239241
/**
240242
* model's temporary ID
241243
*/
@@ -298,7 +300,7 @@ export interface ModelInstance<D extends {} = {}> {
298300
}
299301

300302
/** Model instance clone interface */
301-
export interface ModelInstanceClone<D extends {} = {}>
303+
export interface ModelInstanceClone<D extends {} = AnyData>
302304
extends ModelInstance<D> {
303305
/**
304306
* Commit changes from clone to original

0 commit comments

Comments
 (0)