File tree 2 files changed +3
-2
lines changed
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import { getInstanceStateFromItem } from './identity-map';
16
16
import { getClassTypeFromInstance } from '@deepkit/core' ;
17
17
18
18
export type FlattenIfArray < T > = T extends Array < any > ? T [ 0 ] : T ;
19
- export type FieldName < T > = keyof T & string ;
19
+ export type FieldName < T > = { [ Key in keyof T & string ] : T [ Key ] extends Function ? never : Key } [ keyof T & string ] ;
20
20
21
21
export function getClassSchemaInstancePairs < T extends OrmEntity > ( items : Iterable < T > ) : Map < ReflectionClass < any > , T [ ] > {
22
22
const map = new Map < ReflectionClass < any > , T [ ] > ( ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { assert, IsExact } from 'conditional-type-checks';
4
4
import { Database } from '../src/database' ;
5
5
import { MemoryDatabaseAdapter , MemoryQuery } from '../src/memory-db' ;
6
6
import { Query } from '../src/query' ;
7
+ import { FieldName } from "../src/utils" ;
7
8
8
9
test ( 'query select' , async ( ) => {
9
10
class s {
@@ -54,7 +55,7 @@ test('query lift', async () => {
54
55
55
56
class UserQuery < T extends { username : string } > extends MyBase < T > {
56
57
findAllUserNames ( ) {
57
- return this . findField ( 'username' ) ;
58
+ return this . findField ( 'username' as FieldName < T > ) ;
58
59
}
59
60
60
61
//query classes should be able to infer the actual used class
You can’t perform that action at this time.
0 commit comments