Files
D N b99ddaf606 feat: [TypeScript] Add missing methods types Promise.try + Promise.withResolvers (#57215)
Summary:
New methods `Promise.try` and `Promise.withResolvers` were added to the Hermes V1 branch, see: https://github.com/facebook/hermes/pull/2020

I tested them on the latest RN 0.86.0, and they are working:
```tsx
console.log({
  'ReactNativeVersion.getVersionString()':ReactNativeVersion.getVersionString(),
  'Promise.try': Promise.try,
  'Promise.withResolvers': Promise.withResolvers,
});
//{
//  "Promise.try": [Function anonymous],
//  "Promise.withResolvers": [Function anonymous],
//  "ReactNativeVersion.getVersionString()": "0.86.0"
// }
```

- `es2024.promise` - includes `Promise.withResolvers`
- `esnext.promise` - includes `Promise.try`

## Changelog:

[GENERAL] [ADDED] - Add `Promise.try` + `Promise.withResolvers` typescript types

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

Test Plan:
```
edit `node_modules/react-native/typescript-config/tsconfig.json`
add `es2024.promise` `esnext.promise`
try to use new methods in ts files

// no error expected
```

Reviewed By: robhogan

Differential Revision: D108745447

Pulled By: fabriziocucci

fbshipit-source-id: dfebe404ab45bc4cb9071692d2f13c42b2816e51
2026-06-16 06:16:40 -07:00

47 lines
1.2 KiB
JSON

{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "React Native",
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"types": ["jest"],
"lib": [
"es2019",
"es2020.bigint",
"es2020.date",
"es2020.number",
"es2020.promise",
"es2020.string",
"es2020.symbol.wellknown",
"es2021.promise",
"es2021.string",
"es2021.weakref",
"es2022.array",
"es2022.error",
"es2022.object",
"es2022.string",
"es2024.promise",
"esnext.promise"
],
"allowJs": true,
"jsx": "react-native",
"noEmit": true,
"isolatedModules": true,
"strict": true,
"moduleResolution": "bundler",
"customConditions": ["react-native"],
"allowImportingTsExtensions": true,
"allowArbitraryExtensions": true,
"resolveJsonModule": true,
"resolvePackageJsonImports": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
// Causes issues with package.json "exports"
"forceConsistentCasingInFileNames": false
},
"exclude": [
"**/Pods/**"
]
}