Commit Graph
23 Commits
Author SHA1 Message Date
Sam ZhouandFacebook GitHub Bot 869a976a5d Bump to prettier v3 across xplat (#52844)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52844

Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D78787920

fbshipit-source-id: fc2582001ee6775f53b452dd3659e37521ea6387
2025-07-27 18:50:47 -07:00
Rubén NorteandFacebook GitHub Bot c247554342 Add correct typing for console (including console.timeStamp) (#52632)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52632

Changelog: [internal]

This improves the type definitions for methods in the global `console` object, most importantly:
- Removes use of `any`.
- Defines correct typing for `console.timeStamp`, including new parameters for the Chrome Extensibility API.

Reviewed By: hoxyq

Differential Revision: D78405314

fbshipit-source-id: 6f31cc3005ff708ef6aa155bcd150d53a845e66c
2025-07-17 08:35:36 -07:00
Alex HuntandFacebook GitHub Bot 44e36e6d9f Consolidate location for Flow libdefs (#51539)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51539

Follow up to D70322032. Relocates some of our newly added Flow library definitions into the package level `flow/` directory, to help disambiguate their use.

**Types directories after changes**

`packages/react-native/`

- `flow/` — Longstanding location for Flow package/global library definitions. Not imported by source code.
- `src/types/` — Contains public typedefs useful to 3P consumers (TypeScript) (today, just `globals.d.ts` as one module). Not imported by source code.
- `src/private/types/` — Source type modules **in Flow**, that **are imported** by other files in `src/private/`.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D75060846

fbshipit-source-id: 750a31e11b8f65579ce0831273df4d3b86335bdc
2025-05-22 10:34:04 -07:00
Sam ZhouandFacebook GitHub Bot fae1532f4b Remove $PropertyType shim
Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D72347503

fbshipit-source-id: 11d00394a0b0e50a28aefdbb984a55ebdbc5bb58
2025-04-02 17:27:55 -07:00
Sam ZhouandFacebook GitHub Bot 185c809afd Move jest libdef in react-native (#50329)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50329

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D71986203

fbshipit-source-id: 5ec9d9238da54277faef6af09fed3ff2c9a8ac3f
2025-03-27 14:21:17 -07:00
Sam ZhouandFacebook GitHub Bot 11e532de4f Make JestMockFn's TArguments type parameter bound by $ReadOnlyArray<mixed> instead of $ReadOnlyArray<any> (#50326)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50326

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D71978753

fbshipit-source-id: 52774ca29f6019b5a1382cc76f6c387ea36532e4
2025-03-27 10:23:12 -07:00
Sam ZhouandFacebook GitHub Bot 171c6808b9 Align react-native jest definition with internal jest definition (#50272)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50272

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D71849789

fbshipit-source-id: 5b600c4371a21a28272538022234e2cc01e8d92b
2025-03-25 19:13:58 -07:00
Sam ZhouandFacebook GitHub Bot a70fe45370 Shim $PropertyType in react-native for now (#50271)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50271

In the next version of Flow, support for `$PropertyType` will be removed in favor of indexed access types. The final 2 usages in react-native is in `ReactNativeTypes`, which is synced from upstream react. Sync of https://github.com/facebook/react/pull/32733 is currently blocked by test failures, so I will add the temporary shim to unblock releases.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D71849353

fbshipit-source-id: d4787fe17ae52aa50d54f9fb7fb8b14c149aa1e6
2025-03-25 18:08:26 -07:00
Sam ZhouandFacebook GitHub Bot be7abbcf3f Minor fixes for jest libdef (#50235)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50235

- Remove duplicate definition for `toBeCalledWith` and `lastCalledWith`.
- Replace `typeof undefined` with `void`
- Make some Array types readonly where we can.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D71762238

fbshipit-source-id: 5c20bd7e941a8c36084e291f23cd6caa27f07eb9
2025-03-24 15:32:25 -07:00
Sam ZhouandFacebook GitHub Bot 2cdd79f4fc Pre-suppress errors ahead of next release
Reviewed By: gkz

Differential Revision: D71039278

fbshipit-source-id: 5d42ee1707335bfb579fa49beeb597d98eba70c5
2025-03-12 09:10:02 -07:00
Sam ZhouandFacebook GitHub Bot d98fc9de2d Align internal and external definition of describe function from jest (#49934)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49934

The typing of internal version of jest and the libdef in react-native has diverged a bit. This diff aligns the typing for `describe`

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D70917375

fbshipit-source-id: 9c2ab98a08394aa187712f4966748a8a60e202b1
2025-03-10 15:19:38 -07:00
Rubén NorteandFacebook GitHub Bot 84a1211773 Strip all "bom" types that are actually not defined in RN (#49730)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49730

Changelog: [internal]

This removes all the types from "bom" that are actually not implemented in RN. For now, we're just stripping whole interfaces and not looking into specific methods/properties in interfaces that we do implement but not 100%.

`Performance`, `PerformanceObserver`, `MutationObserver` and `IntersectionObserver` are implemented but not stable yet, so they aren't exposed as globals in the types.

Reviewed By: huntie

Differential Revision: D70329185

fbshipit-source-id: 63bac619e100ca66b41df071df80dfa73d0f9651
2025-02-28 05:58:45 -08:00
Sam ZhouandFacebook GitHub Bot 722f5ba786 Remove global React$ type references (#49276)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49276

This diff replaces the remaining `React$` global types in the codebase, in preparation for their removal in Flow.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D69322418

fbshipit-source-id: 058a2489ce8e6bf59df2ec4e61e9708f63561671
2025-02-07 18:01:43 -08:00
Dawid MałeckiandFacebook GitHub Bot f36bfe5dfa Remove redundant {||} syntax (#48686)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48686

Changelog:
[Internal] - Removed redundant `{||}` syntax

Reviewed By: javache

Differential Revision: D68205038

fbshipit-source-id: f7d3271142b6443a5859c3b668b7aebd3ce3ef3f
2025-01-15 07:07:01 -08:00
Sam ZhouandFacebook GitHub Bot ae73fe462e Replace React$Element that will cause an error in the future
Summary:
For the ones where `React.MixedElement` would suffice, I change them to `React.MixedElement`. For everything else, I changed it to be `React.Element`

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D60798229

fbshipit-source-id: 40176b44769aade2c6b63a680d03c10056b2ddfa
2024-08-05 18:42:05 -07:00
Gijs WeteringsandFacebook GitHub Bot 67c1a806e6 Flow strictify xplat/js/react-native-github where possible (#41051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41051

Strictifies flow to flow strict-local in files where doing that doesn't cause new flow errors.

Changelog: Internal

Reviewed By: yungsters

Differential Revision: D50369011

fbshipit-source-id: b4a5a26b839b7327a3178e6f5b35246dea365a38
2023-10-18 05:36:33 -07:00
Sam ZhouandFacebook GitHub Bot a53b4a0a2b Make React.Element fully opaque (#40883)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40883

Changelog: [Internal]

Reviewed By: mvitousek

Differential Revision: D50198503

fbshipit-source-id: 47537aeefbc6cbdee8954ea1052ff3a4b4392744
2023-10-12 13:48:22 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot 621a7a8634 Extend expected Flow type of the global.performance object to match Performance API (#37917)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37917

# Changelog:
[Internal] -

The `global.performance` object now has all of the API defined according to the `Performance` API, so we can modify the local RN's flow definition override correspondingly.

Reviewed By: NickGerleman

Differential Revision: D46762326

fbshipit-source-id: 0d0b9ea271a91008e775d8cf59693c35758f71e5
2023-06-16 02:12:23 -07:00
Rubén NorteandFacebook GitHub Bot b46992de8a Type mock.contexts correctly in Jest (#37847)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37847

Jest supports accessing the contexts used to call mock functions (the `this` value) but we're not typing that correctly in the definitions in React Native. This changes that.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D46684043

fbshipit-source-id: ff121e0726748788591e7d061a39fde238c1ddbe
2023-06-13 16:36:04 -07:00
George ZaharievandFacebook GitHub Bot 2222b81ec2 Codemod long deprecated * type to any (#36634)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36634

X-link: https://github.com/facebook/metro/pull/957

The existential type `*` has been deprecated and just an alias for `any` since version 0.163. Codemod usage of it to `any`.
This helps with diff D44276187, which makes it always an error to use `*`.

Changelog: [internal]

Reviewed By: pieterv, SamChou19815

Differential Revision: D44358809

fbshipit-source-id: c6bb55430edd086958e16989c60bc2a0a131a3fe
2023-03-24 13:45:38 -07:00
Jiamin ZhuandFacebook GitHub Bot 6956d4f261 Remove dependency on use-sync-external-store
Summary:
Changelog: [Internal]

React Native requires React 18 which includes `useSyncExternalStore`, so we can remove the shim. It was only used in one place (`useColorScheme`).

Reviewed By: motiz88

Differential Revision: D44163914

fbshipit-source-id: 3a94466b3d5ae8aa43e9236acb8c92fbefd04180
2023-03-20 16:08:15 -07:00
Ian JonesandFacebook GitHub Bot 3b8459d66b xplat RN: fix flow for useSyncExternalStore
Summary:
They flow type for useSyncExternalStore is incorrect and in consistent with www.

v1.0.0 of use-sync-external-store has the third parameter:
https://github.com/facebook/react/blob/4997515b96eede5ab1ca622e0439a0707f8d4afd/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L37
This revision is 1.0.0:
https://github.com/facebook/react/blob/4997515b96eede5ab1ca622e0439a0707f8d4afd/packages/use-sync-external-store/package.json

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D44163470

fbshipit-source-id: 6582b20ba09f5840b444a1ca3d8fc12d6c783a00
2023-03-17 06:20:15 -07:00
Ruslan LesiutinandFacebook GitHub Bot 714b502b0c | RN Monorepo | Migrate to package (#36434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36434

Changelog: [Internal]

This is a squashed stack of 18 commits, starting from D43202126

allow-large-files

Reviewed By: cortinico

Differential Revision: D43977381

fbshipit-source-id: 0da552ddb85f2f61a0be0ef071915b35f3f8555c
2023-03-17 05:03:25 -07:00