File tree Expand file tree Collapse file tree 4 files changed +5
-6
lines changed
json-shared-type/src/types Expand file tree Collapse file tree 4 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 7
7
EntityProps ,
8
8
EntityPropsArray ,
9
9
EntityRelation ,
10
+ IsArray ,
10
11
TypeCast ,
11
12
TypeOfArray ,
12
13
UnionToTuple ,
@@ -79,7 +80,7 @@ export enum TypeField {
79
80
export type TypeForId = Extract < TypeField , TypeField . number | TypeField . string > ;
80
81
81
82
export type FieldWithType < E extends Entity > = {
82
- [ K in EntityProps < E > ] : E [ K ] extends unknown [ ]
83
+ [ K in EntityProps < E > ] : IsArray < E [ K ] > extends true
83
84
? TypeField . array
84
85
: E [ K ] extends Date
85
86
? TypeField . date
Original file line number Diff line number Diff line change @@ -243,7 +243,6 @@ export class TypeormUtilsService<E extends Entity> {
243
243
const paramsName = this . getParamName ( fieldWithAlias ) ;
244
244
245
245
if ( ! isTargetField ( this . _relationFields , fieldName ) ) {
246
-
247
246
if (
248
247
( operand === FilterOperand . ne || operand === FilterOperand . eq ) &&
249
248
( valueConditional === 'null' || valueConditional === null )
@@ -525,7 +524,7 @@ export class TypeormUtilsService<E extends Entity> {
525
524
) ) {
526
525
const [ props , type ] = ObjectTyped . entries ( item ) [ 0 ] ;
527
526
if ( type !== null ) {
528
- target [ props ] = type ;
527
+ target [ props ] = type as any ;
529
528
} else {
530
529
target [ props ] = null as any ;
531
530
}
Original file line number Diff line number Diff line change @@ -61,6 +61,4 @@ export type JSONValue =
61
61
| { [ x : string ] : JSONValue }
62
62
| Array < JSONValue > ;
63
63
64
- export type IsArray < T > = T extends unknown [ ] ? true : false ;
65
-
66
- export type IsPropertyIsArray < E , P extends EntityProps < E > > = IsArray < E [ P ] > ;
64
+ export type IsArray < T > = [ Extract < T , unknown [ ] > ] extends [ never ] ? false : true ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ export type EntityField =
4
4
| boolean
5
5
| string [ ]
6
6
| number [ ]
7
+ | null
7
8
| Date ;
8
9
9
10
export type EntityProps < T > = {
You can’t perform that action at this time.
0 commit comments