fix: Fix image import related type errors#9214
Merged
Conversation
There have been type errors showing up on some PRs relating to image imports; TypeScript interprets them as strings, but we have them typed as `ImageSourcePropType`. The mismatch is there because these image imports are modified later in the build system. Normally this is handled by our type declarations, which declare upfront which types these imports should have. But on some PRs, it seems that TypeScript will evaluate these declarations too late, after files including image imports. I had trouble reproducing this problem on `main`, but it can be seen in the PR #8828 (commit b027cfa). If you include this change on that branch, it resolves the problem.
|
Member
Author
|
This should not require E2E tests because it only affects one lint check. The change is to the TSConfig used just for the |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.




Description
There have been type errors showing up on some PRs relating to image imports; TypeScript interprets them as strings, but we have them typed as
ImageSourcePropType. The mismatch is there because these image imports are modified later in the build system.Normally this is handled by our type declarations, which declare upfront which types these imports should have. But on some PRs, it seems that TypeScript will evaluate these declarations too late, after files including image imports.
I had trouble reproducing this problem on
main, but it can be seen in the PR #8828 (commit b027cfa). If you include this change on that branch, it resolves the problem.Related issues
Resolves lint error on #8828
Manual testing steps
Patch this change onto #8828 and see that the
yarn lint:tsccommand succeedsScreenshots/Recordings
N/A
Pre-merge author checklist
Pre-merge reviewer checklist