C++ Turbo Module > Allow Promise<void> types (#52388)

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

Changelog: [Internal]

Similar to `AsyncCallback<>` (the foundation of `AsyncPromise`) we should allow `void` Promise types in C++ such as `AsyncPromise<>`

Reviewed By: rbergerjr

Differential Revision: D77712020

fbshipit-source-id: d7360df5cc1b77f1e03e5fb73b0b468f6e3a415b
This commit is contained in:
Christoph Purrer
2025-07-06 19:53:51 -07:00
committed by Facebook GitHub Bot
parent 255977a7b9
commit e8709355dc
5 changed files with 33 additions and 15 deletions
@@ -58,6 +58,7 @@ type Examples =
| 'promise'
| 'rejectPromise'
| 'voidFunc'
| 'voidPromise'
| 'setMenuItem'
| 'optionalArgs'
| 'emitDeviceEvent';
@@ -138,6 +139,10 @@ class NativeCxxModuleExampleExample extends React.Component<{}, State> {
.then(() => {})
.catch(e => this._setResult('rejectPromise', e.message)),
voidFunc: () => NativeCxxModuleExample?.voidFunc(),
voidPromise: () =>
NativeCxxModuleExample?.voidPromise().then(valuePromise =>
this._setResult('voidPromise', valuePromise),
),
setMenuItem: () => {
let curValue = '';
NativeCxxModuleExample?.setMenu({