From b99ddaf60661a9b308e9028412fee682e4211d8f Mon Sep 17 00:00:00 2001 From: D N <4661784+retyui@users.noreply.github.com> Date: Tue, 16 Jun 2026 06:16:40 -0700 Subject: [PATCH] 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 --- packages/typescript-config/tsconfig.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/typescript-config/tsconfig.json b/packages/typescript-config/tsconfig.json index 19a70acf720..8b1867d0746 100644 --- a/packages/typescript-config/tsconfig.json +++ b/packages/typescript-config/tsconfig.json @@ -19,7 +19,9 @@ "es2022.array", "es2022.error", "es2022.object", - "es2022.string" + "es2022.string", + "es2024.promise", + "esnext.promise" ], "allowJs": true, "jsx": "react-native",