@@ -5,6 +5,7 @@ import * as ActionCable from 'actioncable'
55ArSyncModel . setConnectionAdapter ( new ActionCableAdapter ( ActionCable ) )
66
77type IsEqual < T , U > = [ T , U ] extends [ U , T ] ? true : false
8+ type IsNotEqual < T , U > = IsEqual < T , U > extends true ? false : true
89function isOK < T extends true > ( ) : T | undefined { return }
910type IsStrictMode = string | null extends string ? false : true
1011type TypeIncludes < T extends { } , U extends { } > = IsEqual < Pick < T , keyof T & keyof U > , U >
@@ -13,6 +14,7 @@ isOK<IsStrictMode>()
1314
1415const [ hooksData1 ] = useArSyncModel ( { api : 'currentUser' , query : 'id' } )
1516isOK < IsEqual < typeof hooksData1 , { id : number } | null > > ( )
17+ isOK < IsNotEqual < typeof hooksData1 , { id : string } | null > > ( )
1618const [ hooksData2 ] = useArSyncModel ( { api : 'currentUser' , query : { '*' : true , foo : true } } )
1719isOK < HasExtraField < typeof hooksData2 , 'foo' > > ( )
1820const [ hooksData3 ] = useArSyncFetch ( { api : 'currentUser' , query : 'id' } )
@@ -22,6 +24,7 @@ isOK<HasExtraField<typeof hooksData4, 'foo'>>()
2224
2325const data1 = new ArSyncModel ( { api : 'currentUser' , query : 'id' } ) . data !
2426isOK < IsEqual < typeof data1 , { id : number } > > ( )
27+ isOK < IsNotEqual < typeof data1 , { id : string } > > ( )
2528const data2 = new ArSyncModel ( { api : 'currentUser' , query : [ 'id' , 'name' ] } ) . data !
2629isOK < IsEqual < typeof data2 , { id : number ; name : string | null } > > ( )
2730const data3 = new ArSyncModel ( { api : 'currentUser' , query : '*' } ) . data !
0 commit comments