Files
react-native/packages
Skander Ellouze 2be1c71cb7 refactor(image typing): use ImageRequireSource instead of number for defaultSource prop typing (#40801)
Summary:
This is just a type refactoring to make the typing of the `defaultSource` prop of the Image component more explicit and descriptive (using the `ImageRequireSource` type makes it more clear that we can use the require statement to set an image asset as default source) and this is also more consistent with the `source` prop typing.

Currently :
- The typing of default source is `ImageURISource | number | undefined`
- The typing of source is `ImageSourcePropType` which is equal to `ImageURISource  | ImageURISource[]  | ImageRequireSource` and `ImageRequireSource` is equal to `number`.

In this PR we change the typing of default source to `ImageURISource | ImageRequireSource | undefined` to make more clear that the number of the default source prop refers to the use of the require statement with an asset file.

## Changelog:
[GENERAL] [CHANGED] - use ImageRequireSource instead of number for the defaultSource prop typing of the Image component

Pull Request resolved: https://github.com/facebook/react-native/pull/40801

Test Plan: No one required since it's a small typing refactoring.

Reviewed By: christophpurrer

Differential Revision: D50209922

Pulled By: NickGerleman

fbshipit-source-id: c25f3c6f145f357ff1cb0b1c7b54a19bf1dec824
2023-10-12 03:28:53 -07:00
..