Skip to content

Commit 75d1088

Browse files
committed
Add more type annotations
1 parent 5a2ca50 commit 75d1088

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/controls/src/widget_upload.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
import { CoreDOMWidgetModel } from './widget_core';
55
import { DOMWidgetView } from '@jupyter-widgets/base';
66

7+
interface IFileUploaded {
8+
content: any;
9+
name: string;
10+
size: number;
11+
type: string;
12+
lastModified: number;
13+
error: string;
14+
}
15+
716
export class FileUploadModel extends CoreDOMWidgetModel {
817
defaults(): Backbone.ObjectHash {
918
return {
@@ -58,16 +67,9 @@ export class FileUploadView extends DOMWidgetView {
5867
});
5968

6069
this.fileInput.addEventListener('change', () => {
61-
const promisesFile: Promise<{
62-
content: any;
63-
name: string;
64-
size: number;
65-
type: string;
66-
lastModified: number;
67-
error: string;
68-
}>[] = [];
69-
70-
Array.from(this.fileInput.files ?? []).forEach(file => {
70+
const promisesFile: Promise<IFileUploaded>[] = [];
71+
72+
Array.from(this.fileInput.files ?? []).forEach((file: File) => {
7173
promisesFile.push(
7274
new Promise((resolve, reject) => {
7375
const metadata = {

0 commit comments

Comments
 (0)