Skip to content

Commit

Permalink
Dom: Add type-checking to data-transfer (#29682)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend authored Mar 9, 2021
1 parent ee36d98 commit fed1fb8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/dom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ _Parameters_
_Returns_
- `Object[]`: An array containing all files.
- `File[]`: An array containing all files.
<a name="getOffsetParent" href="#getOffsetParent">#</a> **getOffsetParent**
Expand Down
4 changes: 2 additions & 2 deletions packages/dom/src/data-transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*
* @param {DataTransfer} dataTransfer DataTransfer object to inspect.
*
* @return {Object[]} An array containing all files.
* @return {File[]} An array containing all files.
*/
export function getFilesFromDataTransfer( dataTransfer ) {
const files = [ ...dataTransfer.files ];
const files = Array.from( dataTransfer.files );

Array.from( dataTransfer.items ).forEach( ( item ) => {
const file = item.getAsFile();
Expand Down
8 changes: 8 additions & 0 deletions packages/dom/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"declarationDir": "build-types"
},
"include": [ "src/data-transfer.js" ]
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{ "path": "packages/block-editor" },
{ "path": "packages/components" },
{ "path": "packages/deprecated" },
{ "path": "packages/dom" },
{ "path": "packages/element" },
{ "path": "packages/dom-ready" },
{ "path": "packages/escape-html" },
Expand Down

0 comments on commit fed1fb8

Please sign in to comment.