diff --git a/test/translations/structs/infer_namespaced_struct_from_union.cs b/test/translations/structs/infer_namespaced_struct_from_union.cs new file mode 100644 index 00000000..afeb7d49 --- /dev/null +++ b/test/translations/structs/infer_namespaced_struct_from_union.cs @@ -0,0 +1,6 @@ +Takes(new MyProps { + Struct = new MyLib.SomeStruct { + Enabled = false, + Option = "option" + } +}); \ No newline at end of file diff --git a/test/translations/structs/infer_namespaced_struct_from_union.go b/test/translations/structs/infer_namespaced_struct_from_union.go new file mode 100644 index 00000000..7389f65b --- /dev/null +++ b/test/translations/structs/infer_namespaced_struct_from_union.go @@ -0,0 +1,8 @@ +takes(&myProps{ + Struct: &myLib.someStruct{ + Enabled: jsii.Boolean(false), + Option: jsii.String("option"), + }, +}) + + diff --git a/test/translations/structs/infer_namespaced_struct_from_union.java b/test/translations/structs/infer_namespaced_struct_from_union.java new file mode 100644 index 00000000..9967d0a6 --- /dev/null +++ b/test/translations/structs/infer_namespaced_struct_from_union.java @@ -0,0 +1,6 @@ +takes(MyProps.builder() + .struct(MyLib.SomeStruct.builder() + .enabled(false) + .option("option") + .build()) + .build()); \ No newline at end of file diff --git a/test/translations/structs/infer_namespaced_struct_from_union.py b/test/translations/structs/infer_namespaced_struct_from_union.py new file mode 100644 index 00000000..8802e34f --- /dev/null +++ b/test/translations/structs/infer_namespaced_struct_from_union.py @@ -0,0 +1,6 @@ +takes( + struct=MyLib.SomeStruct( + enabled=False, + option="option" + ) +) diff --git a/test/translations/structs/infer_namespaced_struct_from_union.ts b/test/translations/structs/infer_namespaced_struct_from_union.ts new file mode 100644 index 00000000..885a7a64 --- /dev/null +++ b/test/translations/structs/infer_namespaced_struct_from_union.ts @@ -0,0 +1,28 @@ +/// !hide +/// fake-from-jsii +interface IResolvable { + resolve(): any; +} + +namespace MyLib { + /// fake-from-jsii + interface SomeStruct { + readonly enabled: boolean | IResolvable; + readonly option?: string | IResolvable; + } + + /// fake-from-jsii + export interface MyProps { + readonly struct?: IResolvable | SomeStruct; + } +} + +function takes(props: MyLib.MyProps) {} +/// !show + +takes({ + struct: { + enabled: false, + option: 'option', + }, +});