@@ -16,13 +16,19 @@ import { getInstanceStateFromItem } from './identity-map';
1616import { getClassTypeFromInstance } from '@deepkit/core' ;
1717
1818export type FlattenIfArray < T > = T extends Array < any > ? T [ 0 ] : T ;
19- export type FieldName < T > = keyof T & string ;
19+ export type FieldName < T > = {
20+ [ Key in keyof T & string ] : T [ Key ] extends Function ? never : Key ;
21+ } [ keyof T & string ] ;
2022
21- export function getClassSchemaInstancePairs < T extends OrmEntity > ( items : Iterable < T > ) : Map < ReflectionClass < any > , T [ ] > {
23+ export function getClassSchemaInstancePairs < T extends OrmEntity > (
24+ items : Iterable < T >
25+ ) : Map < ReflectionClass < any > , T [ ] > {
2226 const map = new Map < ReflectionClass < any > , T [ ] > ( ) ;
2327
2428 for ( const item of items ) {
25- const classSchema = ReflectionClass . from ( getClassTypeFromInstance ( item ) ) ;
29+ const classSchema = ReflectionClass . from (
30+ getClassTypeFromInstance ( item )
31+ ) ;
2632 let items = map . get ( classSchema ) ;
2733 if ( ! items ) {
2834 items = [ ] ;
@@ -34,13 +40,18 @@ export function getClassSchemaInstancePairs<T extends OrmEntity>(items: Iterable
3440 return map ;
3541}
3642
37-
38- export function findQuerySatisfied < T extends { [ index : string ] : any } > ( target : T , query : FilterQuery < T > ) : boolean {
43+ export function findQuerySatisfied < T extends { [ index : string ] : any } > (
44+ target : T ,
45+ query : FilterQuery < T >
46+ ) : boolean {
3947 //get rid of "Excessive stack depth comparing types 'any' and 'SiftQuery<T[]>'."
4048 return ( sift as any ) ( query as any , [ target ] as any [ ] ) . length > 0 ;
4149}
4250
43- export function findQueryList < T extends { [ index : string ] : any } > ( items : T [ ] , query : FilterQuery < T > ) : T [ ] {
51+ export function findQueryList < T extends { [ index : string ] : any } > (
52+ items : T [ ] ,
53+ query : FilterQuery < T >
54+ ) : T [ ] {
4455 //get rid of "Excessive stack depth comparing types 'any' and 'SiftQuery<T[]>'."
4556 return ( sift as any ) ( query as any , items as any [ ] ) ;
4657}
@@ -53,5 +64,8 @@ export function buildChangesFromInstance<T>(item: T): Changes<T> {
5364 const state = getInstanceStateFromItem ( item ) ;
5465 const lastSnapshot = state . getSnapshot ( ) ;
5566 const currentSnapshot = state . classState . snapshot ( item ) ;
56- return state . classState . changeDetector ( lastSnapshot , currentSnapshot , item ) || new Changes ;
67+ return (
68+ state . classState . changeDetector ( lastSnapshot , currentSnapshot , item ) ||
69+ new Changes ( )
70+ ) ;
5771}
0 commit comments