-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat[isRecordObjectOf]: checks own symbol key properties #110
feat[isRecordObjectOf]: checks own symbol key properties #110
Conversation
@lambdalisue
Example: class Foo {
a = "a";
}
const foo = new Foo(); // foo has no own properties.
isRecordOf(is.String)(foo); // true
isRecordOf(is.Number)(foo); // false
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## symbol-properties-wip #110 +/- ##
======================================================
Coverage 98.04% 98.05%
======================================================
Files 50 50
Lines 817 821 +4
Branches 88 89 +1
======================================================
+ Hits 801 805 +4
Misses 16 16 ☔ View full report in Codecov by Sentry. |
No. Because TypeScript's behavior is different class Foo {
a = "a";
}
const _foo: Record<PropertyKey, string> = new Foo();
const _bar: Record<PropertyKey, string> = { a: "a" };
Yes. Because TypeScript's behavior is so const s = Symbol("symbol");
const _foo: Record<PropertyKey, string> = { a: "a", [s]: "b" };
const _bar: Record<PropertyKey, string> = { a: "a", [s]: 0 }; |
@lambdalisue Isn't the second example like this? const s = Symbol("s");
class Foo {
[s] = "a";
}
const foo = new Foo();
isRecordOf(is.String)(foo); // true?
isRecordOf(is.Number)(foo); // false? |
d025d34
to
27f86b1
Compare
I fixed this behavior like. |
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.
LGTM
Contains bug fixes. See below comments.