Add some type detection (#19239)
Son Ki-Kyun committed
Jul 2, 2020 at 22:54 UTC
cd9046f81588c88b5f89b591a4a66b13e6f49075
2 files changed
+6
-2
packages/react-dom/src/events/getEventCharCode.js
+3
-1
@@ -3,6 +3,8 @@
3
*
4
* This source code is licensed under the MIT license found in the
5
* LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
*/
9
10
/**
@@ -15,7 +17,7 @@
17
* @param {object} nativeEvent Native browser event.
18
* @return {number} Normalized `charCode` property.
19
*/
18
-function getEventCharCode(nativeEvent) {
20
+function getEventCharCode(nativeEvent: KeyboardEvent): number {
21
let charCode;
22
const keyCode = nativeEvent.keyCode;
23
packages/react-dom/src/events/isEventSupported.js
+3
-1
@@ -3,6 +3,8 @@
3
*
4
* This source code is licensed under the MIT license found in the
5
* LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
*/
9
10
import {canUseDOM} from 'shared/ExecutionEnvironment';
@@ -20,7 +22,7 @@ import {canUseDOM} from 'shared/ExecutionEnvironment';
22
* @internal
23
* @license Modernizr 3.0.0pre (Custom Build) | MIT
24
*/
23
-function isEventSupported(eventNameSuffix) {
25
+function isEventSupported(eventNameSuffix: string): boolean {
26
if (!canUseDOM) {
27
return false;
28
}