Commit 7597115 1 parent 2b4773c commit 7597115 Copy full SHA for 7597115
File tree 5 files changed +826
-919
lines changed
5 files changed +826
-919
lines changed Original file line number Diff line number Diff line change 64
64
]
65
65
},
66
66
"devDependencies" : {
67
- "@4c/cli" : " ^3 .0.1" ,
68
- "@4c/rollout" : " ^3 .0.1" ,
67
+ "@4c/cli" : " ^4 .0.1" ,
68
+ "@4c/rollout" : " ^4 .0.1" ,
69
69
"@4c/tsconfig" : " ^0.4.1" ,
70
70
"@babel/cli" : " ^7.18.10" ,
71
71
"@babel/core" : " ^7.18.10" ,
90
90
"eslint-plugin-typescript" : " ^0.14.0" ,
91
91
"hookem" : " ^2.0.1" ,
92
92
"jest" : " ^27.5.1" ,
93
- "lint-staged" : " ^12.5.0 " ,
93
+ "lint-staged" : " ^13.0.3 " ,
94
94
"prettier" : " ^2.7.1" ,
95
- "rollup" : " ^2.78.0 " ,
95
+ "rollup" : " ^2.78.1 " ,
96
96
"rollup-plugin-babel" : " ^4.4.0" ,
97
97
"rollup-plugin-dts" : " ^4.2.2" ,
98
98
"rollup-plugin-filesize" : " ^9.1.2" ,
101
101
"typescript" : " ^4.7.4"
102
102
},
103
103
"dependencies" : {
104
- "property-expr" : " ^2.0.4 " ,
105
- "tiny-case" : " ^1.0.2 " ,
104
+ "property-expr" : " ^2.0.5 " ,
105
+ "tiny-case" : " ^1.0.3 " ,
106
106
"toposort" : " ^2.0.2"
107
107
}
108
108
}
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export type { AnyObject };
29
29
type MakeKeysOptional < T > = T extends AnyObject ? _ < MakePartial < T > > : T ;
30
30
31
31
export type Shape < T extends Maybe < AnyObject > , C = AnyObject > = {
32
- [ field in keyof T ] : ISchema < T [ field ] , C > | Reference ;
32
+ [ field in keyof T ] -? : ISchema < T [ field ] , C > | Reference ;
33
33
} ;
34
34
35
35
export type ObjectSchemaSpec = SchemaSpec < any > & {
@@ -212,7 +212,10 @@ export default class ObjectSchema<
212
212
intermediateValue [ prop ] = value [ prop ] ;
213
213
}
214
214
215
- if ( intermediateValue [ prop ] !== value [ prop ] ) {
215
+ if (
216
+ exists !== prop in intermediateValue ||
217
+ intermediateValue [ prop ] !== value [ prop ]
218
+ ) {
216
219
isChanged = true ;
217
220
}
218
221
}
Original file line number Diff line number Diff line change 1
1
import { forEach } from 'property-expr' ;
2
+ import type Reference from '../Reference' ;
3
+ import type { ISchema } from '../types' ;
2
4
3
5
let trim = ( part : string ) => part . substr ( 0 , part . length - 1 ) . substr ( 1 ) ;
4
6
@@ -7,7 +9,11 @@ export function getIn<C = any>(
7
9
path : string ,
8
10
value ?: any ,
9
11
context : C = value ,
10
- ) {
12
+ ) : {
13
+ schema : ISchema < any > | Reference ;
14
+ parent : any ;
15
+ parentPath : string ;
16
+ } {
11
17
let parent : any , lastPart : string , lastPartDebug : string ;
12
18
13
19
// root path: ''
Original file line number Diff line number Diff line change @@ -962,3 +962,14 @@ Conditions: {
962
962
. when ( 'foo' , ( [ foo ] ) => ( foo ? string ( ) : number ( ) ) )
963
963
. min ( 1 ) ;
964
964
}
965
+
966
+ TypeAssigning: {
967
+ // $ExpectError unknown is not assignable to () => any
968
+ const _schema : ObjectSchema < {
969
+ mtime ?: Date | null | undefined ;
970
+ toJSON : ( ) => any ;
971
+ } > = object ( {
972
+ mtime : date ( ) . nullable ( ) ,
973
+ toJSON : mixed ( ) . required ( ) ,
974
+ } ) ;
975
+ }
You can’t perform that action at this time.
0 commit comments