[TS migration] Prepare remaining files for Onyx.js migration#507
Merged
MariaHCD merged 18 commits intoExpensify:mainfrom Mar 15, 2024
Merged
[TS migration] Prepare remaining files for Onyx.js migration#507MariaHCD merged 18 commits intoExpensify:mainfrom
MariaHCD merged 18 commits intoExpensify:mainfrom
Conversation
fabioh8010
reviewed
Mar 12, 2024
tests/unit/useOnyxTest.ts
Outdated
|
|
||
| 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'}); |
Contributor
There was a problem hiding this comment.
Why these changes in this file?
Contributor
Author
There was a problem hiding this comment.
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?
Contributor
There was a problem hiding this comment.
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
fabioh8010
reviewed
Mar 14, 2024
tests/unit/useOnyxTest.ts
Outdated
|
|
||
| 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'}); |
Contributor
There was a problem hiding this comment.
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
fabioh8010
reviewed
Mar 14, 2024
MariaHCD
approved these changes
Mar 15, 2024
50 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 Issuessection aboveTestssectiontoggleReportand notonIconClick)myBool && <MyComponent />.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Avataris modified, I verified thatAvataris working as expected in all cases)mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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