Skip to content

Commit 9f7093c

Browse files
Simplify C++ TM struct generation (facebook#3947)
Update documentation to match: facebook/react-native#41645
1 parent 59278e7 commit 9f7093c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

docs/the-new-architecture/cxx-custom-types.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,10 @@ This works - but is quite complex.
257257
[**Codegen**](pillars-codegen.md) for C++ Turbo Native Modules does support struct generators, so you can simplify the code above in `NativeSampleModule.h` to:
258258

259259
```cpp
260-
using CustomType = NativeSampleModuleBaseCustomType<std::string, bool, std::optional<int32_t>>;
260+
using CustomType = NativeSampleModuleCustomType<std::string, bool, std::optional<int32_t>>;
261261
template <>
262262
struct Bridging<CustomType>
263-
: NativeSampleModuleBaseCustomTypeBridging<std::string, bool, std::optional<int32_t>> {};
263+
: NativeSampleModuleCustomTypeBridging<CustomType> {};
264264
```
265265
266266
With `using CustomType` you declare a name for your concrete struct.
@@ -276,10 +276,9 @@ Without any custom conversion functions:
276276
277277
#### Base class
278278
279-
`NativeSampleModuleBaseCustomType` is an auto-generated template in your `AppSpecsJSI.h` which name is generated by:
279+
`NativeSampleModuleCustomType` is an auto-generated template in your `AppSpecsJSI.h` which name is generated by:
280280
281281
- `NativeSampleModule` (name of C++ Turbo Native Module in the JavaScript spec) +
282-
- `Base` (constant) +
283282
- `CustomType` (name of type in the JavaScript spec)
284283
285284
The same naming schema applies to the necessary `Bridging` struct which is defined via `struct Bridging<CustomType>`.

0 commit comments

Comments
 (0)