Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate jest-get-type to TypeScript #7818

Merged
merged 4 commits into from
Feb 6, 2019
Merged

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Feb 6, 2019

Summary

Build diff:

diff --git c/packages/jest-get-type/build/index.js w/packages/jest-get-type/build/index.js
index e3a0a41f1..15c318ee8 100644
--- c/packages/jest-get-type/build/index.js
+++ w/packages/jest-get-type/build/index.js
@@ -1,13 +1,11 @@
+'use strict';
+
 /**
  * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
- *
- *
  */
-'use strict';
-
 // get the type of a value with handling the edge cases like `typeof []`
 // and `typeof null`
 const getType = value => {
@@ -26,17 +24,19 @@ const getType = value => {
   } else if (typeof value === 'string') {
     return 'string';
   } else if (typeof value === 'object') {
-    if (value.constructor === RegExp) {
-      return 'regexp';
-    } else if (value.constructor === Map) {
-      return 'map';
-    } else if (value.constructor === Set) {
-      return 'set';
-    } else if (value.constructor === Date) {
-      return 'date';
+    if (value != null) {
+      if (value.constructor === RegExp) {
+        return 'regexp';
+      } else if (value.constructor === Map) {
+        return 'map';
+      } else if (value.constructor === Set) {
+        return 'set';
+      } else if (value.constructor === Date) {
+        return 'date';
+      }
     }
 
-    return 'object'; // $FlowFixMe https://github.com/facebook/flow/issues/1015
+    return 'object';
   } else if (typeof value === 'symbol') {
     return 'symbol';
   }

Test plan

Green CI

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants