@@ -78,23 +78,22 @@ export interface ModelPropertiesDeclaration {
78
78
*
79
79
* @hidden
80
80
*/
81
- export type ModelPropertiesDeclarationToProperties <
82
- T extends ModelPropertiesDeclaration
83
- > = T extends { [ k : string ] : IAnyType } // optimization to reduce nesting
84
- ? T
85
- : {
86
- [ K in keyof T ] : T [ K ] extends IAnyType // keep IAnyType check on the top to reduce nesting
87
- ? T [ K ]
88
- : T [ K ] extends string
89
- ? IType < string | undefined , string , string >
90
- : T [ K ] extends number
91
- ? IType < number | undefined , number , number >
92
- : T [ K ] extends boolean
93
- ? IType < boolean | undefined , boolean , boolean >
94
- : T [ K ] extends Date
95
- ? IType < number | Date | undefined , number , Date >
96
- : never
97
- }
81
+ export type ModelPropertiesDeclarationToProperties < T extends ModelPropertiesDeclaration > =
82
+ T extends { [ k : string ] : IAnyType } // optimization to reduce nesting
83
+ ? T
84
+ : {
85
+ [ K in keyof T ] : T [ K ] extends IAnyType // keep IAnyType check on the top to reduce nesting
86
+ ? T [ K ]
87
+ : T [ K ] extends string
88
+ ? IType < string | undefined , string , string >
89
+ : T [ K ] extends number
90
+ ? IType < number | undefined , number , number >
91
+ : T [ K ] extends boolean
92
+ ? IType < boolean | undefined , boolean , boolean >
93
+ : T [ K ] extends Date
94
+ ? IType < number | Date | undefined , number , Date >
95
+ : never
96
+ }
98
97
99
98
/**
100
99
* Checks if a value is optional (undefined, any or unknown).
@@ -135,8 +134,7 @@ export interface NonEmptyObject {
135
134
export type ExtractCFromProps < P extends ModelProperties > = { [ k in keyof P ] : P [ k ] [ "CreationType" ] }
136
135
137
136
/** @hidden */
138
- export type ModelCreationType < PC > = { [ P in DefinablePropsNames < PC > ] : PC [ P ] } &
139
- Partial < PC > &
137
+ export type ModelCreationType < PC > = { [ P in DefinablePropsNames < PC > ] : PC [ P ] } & Partial < PC > &
140
138
NonEmptyObject
141
139
142
140
/** @hidden */
@@ -148,8 +146,7 @@ export type ModelCreationType2<P extends ModelProperties, CustomC> = _CustomOrOt
148
146
/** @hidden */
149
147
export type ModelSnapshotType < P extends ModelProperties > = {
150
148
[ K in keyof P ] : P [ K ] [ "SnapshotType" ]
151
- } &
152
- NonEmptyObject
149
+ } & NonEmptyObject
153
150
154
151
/** @hidden */
155
152
export type ModelSnapshotType2 < P extends ModelProperties , CustomS > = _CustomOrOther <
@@ -161,8 +158,9 @@ export type ModelSnapshotType2<P extends ModelProperties, CustomS> = _CustomOrOt
161
158
* @hidden
162
159
* we keep this separate from ModelInstanceType to shorten model instance types generated declarations
163
160
*/
164
- export type ModelInstanceTypeProps < P extends ModelProperties > = { [ K in keyof P ] : P [ K ] [ "Type" ] } &
165
- NonEmptyObject
161
+ export type ModelInstanceTypeProps < P extends ModelProperties > = {
162
+ [ K in keyof P ] : P [ K ] [ "Type" ]
163
+ } & NonEmptyObject
166
164
167
165
/**
168
166
* @hidden
@@ -180,8 +178,7 @@ export interface IModelType<
180
178
OTHERS ,
181
179
CustomC = _NotCustomized ,
182
180
CustomS = _NotCustomized
183
- >
184
- extends IType <
181
+ > extends IType <
185
182
ModelCreationType2 < PROPS , CustomC > ,
186
183
ModelSnapshotType2 < PROPS , CustomS > ,
187
184
ModelInstanceType < PROPS , OTHERS >
@@ -212,12 +209,10 @@ export interface IModelType<
212
209
fn : ( self : Instance < this> ) => { actions ?: A ; views ?: V ; state ?: VS }
213
210
) : IModelType < PROPS , OTHERS & A & V & VS , CustomC , CustomS >
214
211
215
- /** @deprecated See `types.snapshotProcessor` */
216
212
preProcessSnapshot < NewC = ModelCreationType2 < PROPS , CustomC > > (
217
213
fn : ( snapshot : NewC ) => ModelCreationType2 < PROPS , CustomC >
218
214
) : IModelType < PROPS , OTHERS , NewC , CustomS >
219
215
220
- /** @deprecated See `types.snapshotProcessor` */
221
216
postProcessSnapshot < NewS = ModelSnapshotType2 < PROPS , CustomS > > (
222
217
fn : ( snapshot : ModelSnapshotType2 < PROPS , CustomS > ) => NewS
223
218
) : IModelType < PROPS , OTHERS , CustomC , NewS >
@@ -318,18 +313,19 @@ function toPropertiesObject(declaredProps: ModelPropertiesDeclaration): ModelPro
318
313
* @hidden
319
314
*/
320
315
export class ModelType <
321
- PROPS extends ModelProperties ,
322
- OTHERS ,
323
- CustomC ,
324
- CustomS ,
325
- MT extends IModelType < PROPS , OTHERS , CustomC , CustomS >
326
- >
316
+ PROPS extends ModelProperties ,
317
+ OTHERS ,
318
+ CustomC ,
319
+ CustomS ,
320
+ MT extends IModelType < PROPS , OTHERS , CustomC , CustomS >
321
+ >
327
322
extends ComplexType <
328
323
ModelCreationType2 < PROPS , CustomC > ,
329
324
ModelSnapshotType2 < PROPS , CustomS > ,
330
325
ModelInstanceType < PROPS , OTHERS >
331
326
>
332
- implements IModelType < PROPS , OTHERS , CustomC , CustomS > {
327
+ implements IModelType < PROPS , OTHERS , CustomC , CustomS >
328
+ {
333
329
readonly flags = TypeFlags . Object
334
330
335
331
/*
0 commit comments