How about we declear types like below so that we can make code easy to read and simple and avoid code duplication?
type JsonRequestParams = {
method: 'POST' | 'PUT';
data: Dict<Serializable>;
};
type TextRequestParams = {
method: 'POST';
data: string;
contentType: string;
};
type GetRequestParams = {
method: 'GET';
data?: UrlParams;
};
type DeleteRequestParams = {
method: 'DELETE';
};
params?: JsonRequestParams | TextRequestParams | GetRequestParams | DeleteRequestParams
Originally posted by @ioanmo226 in #5372 (comment)
Originally posted by @ioanmo226 in #5372 (comment)