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

Conversation

@SimenB
Copy link
Collaborator

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

@SimenB SimenB merged commit 0c07df0 into facebook:master Feb 6, 2019
0 of 11 checks passed
0 of 11 checks passed
ci/circleci: lint-and-typecheck CircleCI is running your tests
Details
ci/circleci: test-browser CircleCI is running your tests
Details
ci/circleci: test-jest-circus CircleCI is running your tests
Details
ci/circleci: test-node-10 CircleCI is running your tests
Details
ci/circleci: test-node-11 CircleCI is running your tests
Details
ci/circleci: test-node-6 CircleCI is running your tests
Details
ci/circleci: test-node-8 CircleCI is running your tests
Details
ci/circleci: test-or-deploy-website CircleCI is running your tests
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
deploy/netlify Deploy preview processing.
Details
@SimenB SimenB deleted the SimenB:typescript-get-type branch Feb 6, 2019
SerhiiBilyk added a commit to SerhiiBilyk/jest that referenced this pull request Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.