Skip to content

Add HTMLFileInputElement and update HTMLInputElement.#74

Closed
aholmes wants to merge 1 commit intomicrosoft:masterfrom
aholmes:dts-htmlfileinputelement
Closed

Add HTMLFileInputElement and update HTMLInputElement.#74
aholmes wants to merge 1 commit intomicrosoft:masterfrom
aholmes:dts-htmlfileinputelement

Conversation

@aholmes
Copy link
Copy Markdown
Contributor

@aholmes aholmes commented Mar 7, 2016

This change introduces a new interface for file input elements and updates the "files" object of all other input elements.

The existing "files" object is undefined when the input type is not a "file" type. The new interface correctly reflects when the "files" object is a FileList.

This change introduces a new interface for file input elements and updates the "files" object of all other input elements.

The existing "files" object is `undefined` when the input type is not a "file" type. The new interface correctly reflects when the "files" object is a FileList.
@msftclas
Copy link
Copy Markdown

msftclas commented Mar 7, 2016

Hi @aholmes, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Mar 8, 2016

I do not see any reference to the new HTMLFileInputElement in the spec. can you provide some context here?
Also in the future logging an issue on https://github.com/Microsoft/TypeScript/issues first is the correct way to proceed.

files: FileList;
}

declare var HTMLFileInputElement: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this introduces a new value HTMLFileInputElement that does not exisit any where.

@aholmes
Copy link
Copy Markdown
Contributor Author

aholmes commented Mar 8, 2016

My mistake, on both counts. I'll make an issue first next time.

Regarding the type, I wasn't aware the types in lib.d.ts matched the types from the spec and created this type willy nilly. I'm okay with this pull request being rejected for that reason, however, I would like to ask if there is a way to alter HTMLInputElement's interface when it's type is "file".

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Mar 9, 2016

From the sepc: https://html.spec.whatwg.org/multipage/forms.html#dom-input-files

The files IDL attribute allows scripts to access the element's selected files. On getting, if the IDL attribute applies, it must return a FileList object that represents the current selected files. The same object must be returned until the list of selected files changes. If the IDL attribute does not apply, then it must instead return null. [FILEAPI]

so it seems that the right thing to do here is to define files: FileList | null. that needs the nullable types proposal to be in, see microsoft/TypeScript#7140.

I would punt on this PR. but please file an issue to track chainging the definition to include null when microsoft/TypeScript#7140 is merged.

@mhegazy mhegazy closed this Mar 9, 2016
orta pushed a commit to orta/TSJS-lib-generator that referenced this pull request Jun 23, 2021
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.

3 participants