fetch-with-json
Advanced tools
+10
-3
@@ -1,2 +0,3 @@ | ||
| export interface FetchOptions extends RequestInit { | ||
| export type RequestMethod = 'get' | 'delete' | 'head' | 'options' | 'post' | 'put' | 'patch' | 'purge' | 'link' | 'unlink'; | ||
| export interface FetchOptions<M extends string = RequestMethod> extends RequestInit { | ||
| /** | ||
@@ -7,2 +8,8 @@ * The request url. | ||
| /** | ||
| * The request method. You can override the default request method type by | ||
| * specifying your request method type. | ||
| * For example `FetchOptions<MyRequestType>`. | ||
| */ | ||
| method?: M; | ||
| /** | ||
| * The data to send to the server. The data will be stringified using | ||
@@ -80,6 +87,6 @@ * `JSON.stringify` before being sent to the server and the `Content-Type` | ||
| export interface FetchMethod { | ||
| <T = any>(options: FetchOptions): Promise<FetchResponse<T>>; | ||
| <T = any>(options: FetchOptions, rawResponse: true): Promise<Response>; | ||
| <T = any, M extends string = RequestMethod>(options: FetchOptions<M>): Promise<FetchResponse<T>>; | ||
| <T = any, M extends string = RequestMethod>(options: FetchOptions<M>, rawResponse: true): Promise<Response>; | ||
| } | ||
| declare const fetchWithJSON: FetchMethod; | ||
| export default fetchWithJSON; |
+10
-3
@@ -1,2 +0,3 @@ | ||
| export interface FetchOptions extends RequestInit { | ||
| export type RequestMethod = 'get' | 'delete' | 'head' | 'options' | 'post' | 'put' | 'patch' | 'purge' | 'link' | 'unlink'; | ||
| export interface FetchOptions<M extends string = RequestMethod> extends RequestInit { | ||
| /** | ||
@@ -7,2 +8,8 @@ * The request url. | ||
| /** | ||
| * The request method. You can override the default request method type by | ||
| * specifying your request method type. | ||
| * For example `FetchOptions<MyRequestType>`. | ||
| */ | ||
| method?: M; | ||
| /** | ||
| * The data to send to the server. The data will be stringified using | ||
@@ -80,6 +87,6 @@ * `JSON.stringify` before being sent to the server and the `Content-Type` | ||
| export interface FetchMethod { | ||
| <T = any>(options: FetchOptions): Promise<FetchResponse<T>>; | ||
| <T = any>(options: FetchOptions, rawResponse: true): Promise<Response>; | ||
| <T = any, M extends string = RequestMethod>(options: FetchOptions<M>): Promise<FetchResponse<T>>; | ||
| <T = any, M extends string = RequestMethod>(options: FetchOptions<M>, rawResponse: true): Promise<Response>; | ||
| } | ||
| declare const fetchWithJSON: FetchMethod; | ||
| export default fetchWithJSON; |
+1
-1
| { | ||
| "name": "fetch-with-json", | ||
| "description": "Some tweaks to the Fetch API to make it easier to communicate with the server using JSON.", | ||
| "version": "1.0.0", | ||
| "version": "2.0.0-alpha.1", | ||
| "main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "types": "es/index.d.ts", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
23956
3.82%393
3.69%2
100%