mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53739 The previous condition `typeof isESModule extends true` in the definition of `mockComponent` is always `true` (this is expected by semantics of conditional types). See [try-Flow](https://flow.org/try/#1N4Igxg9gdgZglgcxALlAIwIZoKYBsD6uEEAztvhgE6UYCe+JADpdhgCYowa5kA0I2KAFcAtiRQAXSkOz9sADwxgJ+NPTbYuQ3BMnTZA+Y2yU4IwRO4A6SFBIrGVDGM7c+h46fNRLuKxJIGWh8MeT0ZfhYlCStpHzNsFBAMIQkIEQwJODAQfiEyfBE4eWw2fDgofDBMsAALfAA3KjgsXGxxZC4eAw0G-GhcWn9aY3wWZldu-g1mbGqJUoBaCRHEzrcDEgBrbAk62kXhXFxJ923d-cPRHEpTgyEoMDaqZdW7vKgoOfaSKgOKpqmDA+d4gB5fMA-P6LCCMLLQbiLOoYCqgh6-GDYRYIXYLSgkRZkCR4jpddwPfJLZjpOBkUEKTwJEJ+DAkMiUFSwkyZCC3dbdAC+-EgGiSAB1YA9lHBoAACXmICrcAAUAEpZcAJbLtbKYFL4VBdVBlWhkLK0MRnlBVWaVsYIDBzbKFAsoGwSLKpDJZQB+WUARllZoATBrZSwJEJKIbgwBuWUCiVanW2eyy+SBgC8RuVXuwqvjAHpC7LM2XZcHk9qM7LWQGiyWTJReVX04G63Gk4aU9A0-JQ9mYMayfmG6Xy5Xu9XQ3X-WOmy2p+mZx7O1BE1AuxK9Y8DbriqU1RrWzvpXKhwAeABCZotECtAD4TWarzbZVfnfJXe7PfpfQGgwrMMIyjQ1lQABlrD1gVoAtZULAAqWUHjtVg0DaWUEJLDdW1TCQ21LHM8zg4tx2zf1WxrWdY0o9tV3nahF1w3t8P7Qih2VEcSJLMts0nHVlyg+t4MbRjKEolcK3jCUBVyEAGhMEgZSgJIGnAqxgwADn9KxwJAAUgA) A bug in Flow made it so that when this type was exported `typeof isESModule` became `any`, which made it so that the conditional always evaluated to the first part. The bug is fixed in D82193099. This diff uses a type parameter, which can be correctly instantiated at the call site. Changelog: [internal] Reviewed By: SamChou19815 Differential Revision: D82226987 fbshipit-source-id: 411047c10ad88be867fe9b4c5a1672775b3c9322