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:
Yuichiro Tachibana (Tsuchiya) 2023-05-29 11:40:20 +09:00 committed by GitHub
parent 38607c9967
commit b525b122dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
"@gradio/client": patch
---
Refacor types.

View File

@ -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));
}
}