From c0b03c5a60daad9202afca100fadf5ee9ae174f5 Mon Sep 17 00:00:00 2001 From: puckey Date: Mon, 1 Dec 2025 16:37:05 +0100 Subject: [PATCH] test: add SelfReferentialStruct test case Adds a struct with a callback that references the same struct type. Currently fails with "Maximum call stack size exceeded" due to infinite recursion in nitrogen's type walker. --- .../react-native-nitro-test/src/specs/TestObject.nitro.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts b/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts index ddbc2cbfb..b81ba6d38 100644 --- a/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts +++ b/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts @@ -88,6 +88,12 @@ interface MapWrapper { map: Record secondMap: SecondMapWrapper } + +// Self-referential callback in struct (not cyclic - callback is a reference type) +export interface SelfReferentialStruct { + transform?: (config: SelfReferentialStruct) => Promise +} + export type CustomString = CustomType< string, 'CustomString', @@ -234,6 +240,7 @@ interface SharedTestObjectProps { bounceWrappedJsStyleStruct(value: WrappedJsStruct): WrappedJsStruct bounceOptionalWrapper(wrapper: OptionalWrapper): OptionalWrapper bounceOptionalCallback(value: OptionalCallback): OptionalCallback + bounceSelfReferentialStruct(value: SelfReferentialStruct): SelfReferentialStruct // ArrayBuffers createArrayBuffer(): ArrayBuffer