mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
Add overridden type annotations on normalise_file()
to remove @ts-i… (#4315)
* Add overridden type annotations on `normalise_file()` to remove @ts-ignore, and remove its unnecessary export * changeset --------- Co-authored-by: pngwn <hello@pngwn.io>
This commit is contained in:
parent
38607c9967
commit
b525b122dd
5
.changeset/smooth-camels-prove.md
Normal file
5
.changeset/smooth-camels-prove.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@gradio/client": patch
|
||||
---
|
||||
|
||||
Refacor types.
|
@ -708,10 +708,25 @@ function transform_output(
|
||||
return transformed_data;
|
||||
}
|
||||
|
||||
export function normalise_file(
|
||||
file: Array<FileData> | FileData | string | null,
|
||||
function normalise_file(
|
||||
file: Array<FileData>,
|
||||
root: string,
|
||||
root_url: string | null
|
||||
): Array<FileData>;
|
||||
function normalise_file(
|
||||
file: FileData | string,
|
||||
root: string,
|
||||
root_url: string | null
|
||||
): FileData;
|
||||
function normalise_file(
|
||||
file: null,
|
||||
root: string,
|
||||
root_url: string | null
|
||||
): null;
|
||||
function normalise_file(
|
||||
file,
|
||||
root,
|
||||
root_url
|
||||
): Array<FileData> | FileData | null {
|
||||
if (file == null) return null;
|
||||
if (typeof file === "string") {
|
||||
@ -726,7 +741,6 @@ export function normalise_file(
|
||||
if (x === null) {
|
||||
normalized_file.push(null);
|
||||
} else {
|
||||
//@ts-ignore
|
||||
normalized_file.push(normalise_file(x, root, root_url));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user