Skip to content

Conversation

@rch850
Copy link
Contributor

@rch850 rch850 commented Mar 29, 2018

This PR fixes microsoft/TypeScript#4163.

The FileReader API spec says the event target is FileReader so I give FileReader type to target of ev.

@msftclas
Copy link

msftclas commented Mar 29, 2018

CLA assistant check
All CLA requirements met.

onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null;
onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null;
onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null;
onabort: ((this: FileReader, ev: ProgressEvent & {target: FileReader}) => any) | null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would create a new type FilreReaderProgressEvent that extends ProgressEvent and use that instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reviewing. I have added FileReaderProgressEvent.

readonly target: FileReader | null;
}

declare var FileReaderProgressEvent: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be added. set "no-interface-object": 1, on the new interface to avoid the creation of a var.

"override-type": "FileReader | null"
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add "no-interface-object": 1,

@rch850
Copy link
Contributor Author

rch850 commented Mar 30, 2018

Removed unnecessary var FileReaderProgressEvent and made test passed.

@mhegazy mhegazy merged commit 3d9c46f into microsoft:master Mar 30, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Mar 30, 2018

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileReader.onLoad/onLoadEnd event argument has no target.result property

3 participants