-
-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update(eslint): remove some rules from eslint configuration, and fix …
…them
- Loading branch information
1 parent
24aef36
commit 067c736
Showing
6 changed files
with
124 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,89 @@ | ||
/** | ||
* Module declaration for '@codexteam/ajax'. | ||
*/ | ||
declare module '@codexteam/ajax' { | ||
/** | ||
* Options for configuring an Ajax request. | ||
*/ | ||
export interface AjaxOptions { | ||
/** | ||
* The URL to which the request is sent. | ||
*/ | ||
url?: string; | ||
/** | ||
* The data to send with the request. | ||
*/ | ||
data?: object; | ||
/** | ||
* The MIME type of the request. | ||
*/ | ||
accept?: string; | ||
/** | ||
* The headers to send with the request. | ||
*/ | ||
headers?: object; | ||
/** | ||
* A function to call before the request is sent, with the files to be sent. | ||
*/ | ||
beforeSend?: (files: File[]) => void; | ||
/** | ||
* The name of the field in the form data to which the file should be assigned. | ||
*/ | ||
fieldName?: string; | ||
/** | ||
* The type of the request (e.g., 'POST', 'GET'). | ||
*/ | ||
type?: string; | ||
} | ||
|
||
/** | ||
* Parameter type of selectFiles function in AjaxOptions interface | ||
*/ | ||
export type AjaxFileOptionsParam = { | ||
/** | ||
* the accepted file types. | ||
*/ | ||
accept: string; | ||
}; | ||
|
||
/** | ||
* Represents the response from an Ajax request. | ||
* @template T - The type of the response body. | ||
*/ | ||
export interface AjaxResponse<T = object> { | ||
/** The body of the response. */ | ||
body: T; | ||
} | ||
|
||
export function selectFiles(options: { accept: string }): Promise<File[]>; | ||
/** | ||
* Prompts the user to select files and returns a promise that resolves with the selected files. | ||
* @param options - Options for file selection. | ||
* @param options.accept - The accepted file types. | ||
* @returns A promise that resolves with the selected files. | ||
*/ | ||
export function selectFiles(options: AjaxFileOptionsParam): Promise<File[]>; | ||
|
||
/** | ||
* Sends an Ajax request with the specified options. | ||
* @param options - Options for the Ajax request. | ||
* @returns A promise that resolves with the Ajax response. | ||
*/ | ||
export function transport(options: AjaxOptions): Promise<AjaxResponse>; | ||
|
||
/** | ||
* Sends a POST request with the specified options. | ||
* @param options - Options for the POST request. | ||
* @returns A promise that resolves with the Ajax response. | ||
*/ | ||
export function post(options: AjaxOptions): Promise<AjaxResponse>; | ||
|
||
/** | ||
* Represents common content types. | ||
*/ | ||
export const contentType: { | ||
/** | ||
* The MIME type for JSON content. | ||
*/ | ||
JSON: string; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.