Skip to content

Commit

Permalink
Blob: Add types (#19092)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal authored Dec 12, 2019
1 parent 4a6a533 commit 96ab640
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/blob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ _Parameters_

_Returns_

- `?File`: The file for the blob URL.
- `(File|undefined)`: The file for the blob URL.

<a name="isBlobURL" href="#isBlobURL">#</a> **isBlobURL**

Expand Down
5 changes: 4 additions & 1 deletion packages/blob/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*/
const { createObjectURL, revokeObjectURL } = window.URL;

/**
* @type {{[key: string]: File|undefined}}
*/
const cache = {};

/**
Expand All @@ -27,7 +30,7 @@ export function createBlobURL( file ) {
*
* @param {string} url The blob URL.
*
* @return {?File} The file for the blob URL.
* @return {File|undefined} The file for the blob URL.
*/
export function getBlobByURL( url ) {
return cache[ url ];
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"strictNullChecks": true,
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */

/* Additional Checks */
Expand All @@ -21,6 +22,7 @@
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
},
"include": [
"./packages/blob/**/*.js",
"./packages/dom-ready/**/*.js",
"./packages/i18n/**/*.js",
"./packages/is-shallow-equal/**/*.js",
Expand Down

0 comments on commit 96ab640

Please sign in to comment.