Skip to content

Commit

Permalink
Add overridden type annotations on normalise_file() to remove @TS-i… (
Browse files Browse the repository at this point in the history
#4315)

* Add overridden type annotations on `normalise_file()` to remove @ts-ignore, and remove its unnecessary export

* changeset

---------

Co-authored-by: pngwn <[email protected]>
  • Loading branch information
2 people authored and dawoodkhan82 committed Jun 2, 2023
1 parent 38851af commit e106ddd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/smooth-camels-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@gradio/client": patch
---

Refacor types.
20 changes: 17 additions & 3 deletions client/js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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));
}
}
Expand Down

0 comments on commit e106ddd

Please sign in to comment.