@@ -2,7 +2,7 @@ import { expectType, expectError, expectNotType, expectNotAssignable, expectAssi
22
33import type { Collection } from '../../src/collection' ;
44import { ObjectId } from '../../src/bson' ;
5- import type { Filter , WithId } from '../../src/mongo_types' ;
5+ import type { WithId } from '../../src/mongo_types' ;
66
77type InsertOneFirstParam < Schema > = Parameters < Collection < Schema > [ 'insertOne' ] > [ 0 ] ;
88
@@ -44,23 +44,3 @@ interface B {
4444type Data = A | B ;
4545expectAssignable < InsertOneFirstParam < Data > > ( { _id : 2 } ) ;
4646expectAssignable < InsertOneFirstParam < Data > > ( { _id : 'hi' } ) ;
47-
48- // Ensure Exclusive Union Type doesn't break inside our collection methods
49- type Without < T , U > = { [ P in Exclude < keyof T , keyof U > ] ?: never } ;
50- // eslint-disable-next-line @typescript-eslint/ban-types
51- type XOR < T , U > = T | U extends object ? ( Without < T , U > & U ) | ( Without < U , T > & T ) : T | U ;
52-
53- interface Dog {
54- bark : string ;
55- }
56- interface Cat {
57- meow : string ;
58- }
59- type Pet = XOR < Dog , Cat > ;
60- expectNotAssignable < InsertOneFirstParam < Pet > > ( { meow : '' , bark : '' } ) ;
61- expectAssignable < InsertOneFirstParam < Pet > > ( { meow : '' } ) ;
62- expectAssignable < InsertOneFirstParam < Pet > > ( { bark : '' } ) ;
63- expectAssignable < InsertOneFirstParam < Pet > > ( { bark : '' , _id : new ObjectId ( ) } ) ;
64- expectNotAssignable < Filter < Pet > > ( { meow : '' , bark : '' } ) ; // find
65- expectAssignable < Filter < Pet > > ( { bark : '' } ) ;
66- expectAssignable < Filter < Pet > > ( { meow : '' } ) ;
0 commit comments