-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[jest-get-type] Add isPrimitive function #7708
Conversation
c943532
to
2c9e816
Compare
Alright, this should be good to go (and not breaking). Generated type defs are: /**
* 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.
*/
declare type ValueType = 'array' | 'boolean' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'map' | 'set' | 'date' | 'string' | 'symbol' | 'undefined';
declare function getType(value: unknown): ValueType;
declare namespace getType {
var isPrimitive: (value: unknown) => boolean;
}
export = getType;
//# sourceMappingURL=index.d.ts.map |
Codecov Report
@@ Coverage Diff @@
## master #7708 +/- ##
==========================================
- Coverage 64.18% 64.17% -0.01%
==========================================
Files 259 259
Lines 10135 10134 -1
Branches 1752 1752
==========================================
- Hits 6505 6504 -1
Misses 3246 3246
Partials 384 384
Continue to review full report at Codecov.
|
'boolean', | ||
'null', | ||
'undefined', | ||
'symbol', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already merged this, but I'm not sure if I agree Symbol
is a primitive type?
/cc @mattphillips
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://leanpub.com/understandinges6/read#leanpub-auto-symbols-and-symbol-properties
Symbols are a primitive type introduced in ECMAScript 6, joining the existing primitive types: strings, numbers, booleans, null, and undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the 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. |
Summary
Add isPrimitive function to
jest-get-type
.See @rubennorte's comment here #7694 (comment)
Test plan
See unit tests.