@@ -913,38 +913,54 @@ export type EndpointDefinition<
913
913
ResultType ,
914
914
ReducerPath extends string = string ,
915
915
PageParam = any ,
916
+ RawResultType extends BaseQueryResult < BaseQuery > = BaseQueryResult < BaseQuery > ,
916
917
> =
917
- | QueryDefinition < QueryArg , BaseQuery , TagTypes , ResultType , ReducerPath >
918
- | MutationDefinition < QueryArg , BaseQuery , TagTypes , ResultType , ReducerPath >
918
+ | QueryDefinition <
919
+ QueryArg ,
920
+ BaseQuery ,
921
+ TagTypes ,
922
+ ResultType ,
923
+ ReducerPath ,
924
+ RawResultType
925
+ >
926
+ | MutationDefinition <
927
+ QueryArg ,
928
+ BaseQuery ,
929
+ TagTypes ,
930
+ ResultType ,
931
+ ReducerPath ,
932
+ RawResultType
933
+ >
919
934
| InfiniteQueryDefinition <
920
935
QueryArg ,
921
936
PageParam ,
922
937
BaseQuery ,
923
938
TagTypes ,
924
939
ResultType ,
925
- ReducerPath
940
+ ReducerPath ,
941
+ RawResultType
926
942
>
927
943
928
944
export type EndpointDefinitions = Record <
929
945
string ,
930
- EndpointDefinition < any , any , any , any >
946
+ EndpointDefinition < any , any , any , any , any , any , any >
931
947
>
932
948
933
949
export function isQueryDefinition (
934
- e : EndpointDefinition < any , any , any , any > ,
935
- ) : e is QueryDefinition < any , any , any , any > {
950
+ e : EndpointDefinition < any , any , any , any , any , any , any > ,
951
+ ) : e is QueryDefinition < any , any , any , any , any , any > {
936
952
return e . type === DefinitionType . query
937
953
}
938
954
939
955
export function isMutationDefinition (
940
- e : EndpointDefinition < any , any , any , any > ,
941
- ) : e is MutationDefinition < any , any , any , any > {
956
+ e : EndpointDefinition < any , any , any , any , any , any , any > ,
957
+ ) : e is MutationDefinition < any , any , any , any , any , any > {
942
958
return e . type === DefinitionType . mutation
943
959
}
944
960
945
961
export function isInfiniteQueryDefinition (
946
- e : EndpointDefinition < any , any , any , any > ,
947
- ) : e is InfiniteQueryDefinition < any , any , any , any , any > {
962
+ e : EndpointDefinition < any , any , any , any , any , any , any > ,
963
+ ) : e is InfiniteQueryDefinition < any , any , any , any , any , any , any > {
948
964
return e . type === DefinitionType . infinitequery
949
965
}
950
966
@@ -1004,7 +1020,15 @@ export type EndpointBuilder<
1004
1020
> ,
1005
1021
'type'
1006
1022
> ,
1007
- ) : QueryDefinition < QueryArg , BaseQuery , TagTypes , ResultType , ReducerPath >
1023
+ ) : QueryDefinition <
1024
+ QueryArg ,
1025
+ BaseQuery ,
1026
+ TagTypes ,
1027
+ ResultType ,
1028
+ ReducerPath ,
1029
+ RawResultType
1030
+ >
1031
+
1008
1032
/**
1009
1033
* An endpoint definition that alters data on the server or will possibly invalidate the cache.
1010
1034
*
@@ -1048,17 +1072,31 @@ export type EndpointBuilder<
1048
1072
> ,
1049
1073
'type'
1050
1074
> ,
1051
- ) : MutationDefinition < QueryArg , BaseQuery , TagTypes , ResultType , ReducerPath >
1075
+ ) : MutationDefinition <
1076
+ QueryArg ,
1077
+ BaseQuery ,
1078
+ TagTypes ,
1079
+ ResultType ,
1080
+ ReducerPath ,
1081
+ RawResultType
1082
+ >
1052
1083
1053
- infiniteQuery < ResultType , QueryArg , PageParam > (
1084
+ infiniteQuery <
1085
+ ResultType ,
1086
+ QueryArg ,
1087
+ PageParam ,
1088
+ RawResultType extends
1089
+ BaseQueryResult < BaseQuery > = BaseQueryResult < BaseQuery > ,
1090
+ > (
1054
1091
definition : OmitFromUnion <
1055
1092
InfiniteQueryDefinition <
1056
1093
QueryArg ,
1057
1094
PageParam ,
1058
1095
BaseQuery ,
1059
1096
TagTypes ,
1060
1097
ResultType ,
1061
- ReducerPath
1098
+ ReducerPath ,
1099
+ RawResultType
1062
1100
> ,
1063
1101
'type'
1064
1102
> ,
@@ -1068,7 +1106,8 @@ export type EndpointBuilder<
1068
1106
BaseQuery ,
1069
1107
TagTypes ,
1070
1108
ResultType ,
1071
- ReducerPath
1109
+ ReducerPath ,
1110
+ RawResultType
1072
1111
>
1073
1112
}
1074
1113
@@ -1120,16 +1159,16 @@ export type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> =
1120
1159
export type InfiniteQueryArgFrom <
1121
1160
D extends BaseEndpointDefinition < any , any , any , any > ,
1122
1161
> =
1123
- D extends InfiniteQueryDefinition < infer QA , any , any , any , any , any >
1162
+ D extends InfiniteQueryDefinition < infer QA , any , any , any , any , any , any >
1124
1163
? QA
1125
1164
: never
1126
1165
1127
1166
export type QueryArgFromAnyQuery <
1128
1167
D extends BaseEndpointDefinition < any , any , any , any > ,
1129
1168
> =
1130
- D extends InfiniteQueryDefinition < any , any , any , any , any , any >
1169
+ D extends InfiniteQueryDefinition < any , any , any , any , any , any , any >
1131
1170
? InfiniteQueryArgFrom < D >
1132
- : D extends QueryDefinition < any , any , any , any >
1171
+ : D extends QueryDefinition < any , any , any , any , any , any >
1133
1172
? QueryArgFrom < D >
1134
1173
: never
1135
1174
@@ -1138,16 +1177,23 @@ export type ResultTypeFrom<
1138
1177
> = D extends BaseEndpointDefinition < any , any , infer RT , any > ? RT : unknown
1139
1178
1140
1179
export type ReducerPathFrom <
1141
- D extends EndpointDefinition < any , any , any , any , any > ,
1142
- > = D extends EndpointDefinition < any , any , any , any , infer RP > ? RP : unknown
1180
+ D extends EndpointDefinition < any , any , any , any , any , any , any > ,
1181
+ > =
1182
+ D extends EndpointDefinition < any , any , any , any , infer RP , any , any >
1183
+ ? RP
1184
+ : unknown
1143
1185
1144
- export type TagTypesFrom < D extends EndpointDefinition < any , any , any , any > > =
1145
- D extends EndpointDefinition < any , any , infer RP , any > ? RP : unknown
1186
+ export type TagTypesFrom <
1187
+ D extends EndpointDefinition < any , any , any , any , any , any , any > ,
1188
+ > =
1189
+ D extends EndpointDefinition < any , any , infer TT , any , any , any , any >
1190
+ ? TT
1191
+ : unknown
1146
1192
1147
1193
export type PageParamFrom <
1148
- D extends InfiniteQueryDefinition < any , any , any , any , any , any > ,
1194
+ D extends InfiniteQueryDefinition < any , any , any , any , any , any , any > ,
1149
1195
> =
1150
- D extends InfiniteQueryDefinition < any , infer PP , any , any , any , any >
1196
+ D extends InfiniteQueryDefinition < any , infer PP , any , any , any , any , any >
1151
1197
? PP
1152
1198
: unknown
1153
1199
0 commit comments