-
Notifications
You must be signed in to change notification settings - Fork 76
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
[TS migration] Prepare remaining files for Onyx.js migration #507
[TS migration] Prepare remaining files for Onyx.js migration #507
Conversation
tests/unit/useOnyxTest.ts
Outdated
@@ -98,7 +98,7 @@ describe('useOnyx', () => { | |||
}); | |||
|
|||
it('should initially return null while loading non-cached key, and then return value and loaded state', async () => { | |||
await StorageMock.setItem(ONYXKEYS.TEST_KEY, 'test'); | |||
await StorageMock.setItem(ONYXKEYS.TEST_KEY, {test: 'test'}); |
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.
Why these changes in this file?
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.
Typecheck is complaining in this file due to OnyxValue
implementation:
type OnyxValue<TKey extends OnyxKey> = TKey extends CollectionKeyBase ? OnyxCollection<KeyValueMapping[TKey]> : OnyxEntry<KeyValueMapping[TKey]>;
second argument of StorageMock.setItem
results in OnyxCollection<unknown>
, that's why I changed it here. Any other ideas?
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'm in favor of either trying to find a fix for OnyxCollection<unknown>
case or using // @ts-expect-error
because otherwise it would restrict our tests
tests/unit/useOnyxTest.ts
Outdated
@@ -98,7 +98,7 @@ describe('useOnyx', () => { | |||
}); | |||
|
|||
it('should initially return null while loading non-cached key, and then return value and loaded state', async () => { | |||
await StorageMock.setItem(ONYXKEYS.TEST_KEY, 'test'); | |||
await StorageMock.setItem(ONYXKEYS.TEST_KEY, {test: 'test'}); |
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'm in favor of either trying to find a fix for OnyxCollection<unknown>
case or using // @ts-expect-error
because otherwise it would restrict our tests
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.
🚀
Details
This PR fixes various types across Onyx, also adjusting tests in order to fix failing typecheck.
Related Issues
Part of Expensify/App#34344
Automated Tests
N/A
Manual Tests
N/A
Author Checklist
### Related Issues
section aboveTests
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Code is only changed on the type level, I verified it works on web, no further tests needed.
MacOS: Chrome / Safari
web1.mov