Skip to content

Commit 96ab640

Browse files
authored
Blob: Add types (#19092)
1 parent 4a6a533 commit 96ab640

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎packages/blob/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ _Parameters_
3838

3939
_Returns_
4040

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

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

‎packages/blob/src/index.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
*/
44
const { createObjectURL, revokeObjectURL } = window.URL;
55

6+
/**
7+
* @type {{[key: string]: File|undefined}}
8+
*/
69
const cache = {};
710

811
/**
@@ -27,7 +30,7 @@ export function createBlobURL( file ) {
2730
*
2831
* @param {string} url The blob URL.
2932
*
30-
* @return {?File} The file for the blob URL.
33+
* @return {File|undefined} The file for the blob URL.
3134
*/
3235
export function getBlobByURL( url ) {
3336
return cache[ url ];

‎tsconfig.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

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

1718
/* Additional Checks */
@@ -21,6 +22,7 @@
2122
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
2223
},
2324
"include": [
25+
"./packages/blob/**/*.js",
2426
"./packages/dom-ready/**/*.js",
2527
"./packages/i18n/**/*.js",
2628
"./packages/is-shallow-equal/**/*.js",

0 commit comments

Comments
 (0)