File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -3847,4 +3847,31 @@ describe('Query', () => {
38473847 { fruit : 'fruit3' , searchText : 'fruit3' } ,
38483848 ] ) ;
38493849 } ) ;
3850+
3851+ it ( 'flatten types isSuccess isError' , async ( ) => {
3852+ const userQuery = new Query ( {
3853+ enabled : false ,
3854+ queryClient : new QueryClient ( ) ,
3855+ queryFn :
( ) => ( { email :
'[email protected] ' } ) , 3856+ queryKey : [ 'user' ] ,
3857+ } ) ;
3858+
3859+ const userQueryResult = await userQuery . start ( ) ;
3860+
3861+ expectTypeOf ( userQueryResult . data ) . toEqualTypeOf <
3862+ { email : string } | undefined
3863+ > ( ) ;
3864+
3865+ if ( userQueryResult . isSuccess ) {
3866+ expectTypeOf ( userQueryResult . data ) . toEqualTypeOf < { email : string } > ( ) ;
3867+ expectTypeOf ( userQueryResult . error ) . toEqualTypeOf < null > ( ) ;
3868+ }
3869+
3870+ if ( userQueryResult . isError ) {
3871+ expectTypeOf ( userQueryResult . data ) . toEqualTypeOf <
3872+ { email : string } | undefined
3873+ > ( ) ;
3874+ expectTypeOf ( userQueryResult . error ) . toEqualTypeOf < Error > ( ) ;
3875+ }
3876+ } ) ;
38503877} ) ;
You can’t perform that action at this time.
0 commit comments