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 77 EntityProps ,
88 EntityPropsArray ,
99 EntityRelation ,
10+ IsArray ,
1011 TypeCast ,
1112 TypeOfArray ,
1213 UnionToTuple ,
@@ -79,7 +80,7 @@ export enum TypeField {
7980export type TypeForId = Extract < TypeField , TypeField . number | TypeField . string > ;
8081
8182export type FieldWithType < E extends Entity > = {
82- [ K in EntityProps < E > ] : E [ K ] extends unknown [ ]
83+ [ K in EntityProps < E > ] : IsArray < E [ K ] > extends true
8384 ? TypeField . array
8485 : E [ K ] extends Date
8586 ? TypeField . date
Original file line number Diff line number Diff line change @@ -243,7 +243,6 @@ export class TypeormUtilsService<E extends Entity> {
243243 const paramsName = this . getParamName ( fieldWithAlias ) ;
244244
245245 if ( ! isTargetField ( this . _relationFields , fieldName ) ) {
246-
247246 if (
248247 ( operand === FilterOperand . ne || operand === FilterOperand . eq ) &&
249248 ( valueConditional === 'null' || valueConditional === null )
@@ -525,7 +524,7 @@ export class TypeormUtilsService<E extends Entity> {
525524 ) ) {
526525 const [ props , type ] = ObjectTyped . entries ( item ) [ 0 ] ;
527526 if ( type !== null ) {
528- target [ props ] = type ;
527+ target [ props ] = type as any ;
529528 } else {
530529 target [ props ] = null as any ;
531530 }
Original file line number Diff line number Diff line change @@ -61,6 +61,4 @@ export type JSONValue =
6161 | { [ x : string ] : JSONValue }
6262 | Array < JSONValue > ;
6363
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 =
44 | boolean
55 | string [ ]
66 | number [ ]
7+ | null
78 | Date ;
89
910export type EntityProps < T > = {
You can’t perform that action at this time.
0 commit comments