Skip to content

Commit

Permalink
Revert "Simplify C++ TM struct generation (facebook#3930)" (facebook#…
Browse files Browse the repository at this point in the history
…3935)

This reverts commit 7396470.
  • Loading branch information
christophpurrer authored Dec 3, 2023
1 parent 7396470 commit 8400279
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/the-new-architecture/cxx-custom-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ This works - but is quite complex.
[**Codegen**](pillars-codegen.md) for C++ Turbo Native Modules does support struct generators, so you can simplify the code above in `NativeSampleModule.h` to:

```cpp
using CustomType = NativeSampleModuleCustomType<std::string, bool, std::optional<int32_t>>;
using CustomType = NativeSampleModuleBaseCustomType<std::string, bool, std::optional<int32_t>>;
template <>
struct Bridging<CustomType>
: NativeSampleModuleCustomTypeBridging<CustomType> {};
: NativeSampleModuleBaseCustomTypeBridging<std::string, bool, std::optional<int32_t>> {};
```
With `using CustomType` you declare a name for your concrete struct.
Expand All @@ -276,9 +276,10 @@ Without any custom conversion functions:
#### Base class
`NativeSampleModuleCustomType` is an auto-generated template in your `AppSpecsJSI.h` which name is generated by:
`NativeSampleModuleBaseCustomType` is an auto-generated template in your `AppSpecsJSI.h` which name is generated by:
- `NativeSampleModule` (name of C++ Turbo Native Module in the JavaScript spec) +
- `Base` (constant) +
- `CustomType` (name of type in the JavaScript spec)
The same naming schema applies to the necessary `Bridging` struct which is defined via `struct Bridging<CustomType>`.

0 comments on commit 8400279

Please sign in to comment.