@@ -20,7 +20,13 @@ class TuplesTest : FunSpec({
2020 actual.shouldBe(
2121 // language=TypeScript
2222 """
23- |export type SimpleTypes = [string, number, number | null, boolean, string];
23+ |export type SimpleTypes = [
24+ | aString: string,
25+ | anInt: number,
26+ | aDouble: number | null,
27+ | bool: boolean,
28+ | privateMember: string,
29+ |];
2430 """.trimMargin()
2531 .normalize()
2632 )
@@ -40,7 +46,11 @@ class TuplesTest : FunSpec({
4046 actual.shouldBe(
4147 // language=TypeScript
4248 """
43- |export type OptionalFields = [string, string, string | null, string | null];
49+ |export type PostalAddressUSA = [
50+ | houseNumber: string, // @SerialName ("num") was ignored
51+ | street: string, // custom name
52+ | zip: string, // custom name
53+ |];
4454 """.trimMargin()
4555 .normalize()
4656 )
@@ -60,7 +70,12 @@ class TuplesTest : FunSpec({
6070 actual.shouldBe(
6171 // language=TypeScript
6272 """
63- |export type Coordinates = [number, number, number];
73+ |export type OptionalFields = [
74+ | requiredString: string,
75+ | optionalString: string,
76+ | nullableString: string | null,
77+ | nullableOptionalString: string | null,
78+ |];
6479 """.trimMargin()
6580 .normalize()
6681 )
@@ -76,6 +91,30 @@ class TuplesTest : FunSpec({
7691 dev.adamko.kxstsgen.example.exampleTuple04.main()
7792 }.normalizeJoin()
7893
94+ test("expect actual matches TypeScript ") {
95+ actual.shouldBe(
96+ // language=TypeScript
97+ """
98+ |export type Coordinates = [
99+ | x: number,
100+ | y: number,
101+ | z: number,
102+ |];
103+ """.trimMargin()
104+ .normalize()
105+ )
106+ }
107+
108+ test("expect actual compiles").config(tags = tsCompile) {
109+ actual.shouldTypeScriptCompile()
110+ }
111+ }
112+
113+ context("ExampleTuple05 ") {
114+ val actual = captureOutput("ExampleTuple05 ") {
115+ dev.adamko.kxstsgen.example.exampleTuple05.main()
116+ }.normalizeJoin()
117+
79118 test("expect actual matches TypeScript ") {
80119 actual.shouldBe(
81120 // language=TypeScript
@@ -86,7 +125,11 @@ class TuplesTest : FunSpec({
86125 | namedLocations: { [key: string]: Coordinates };
87126 |}
88127 |
89- |export type Coordinates = [number, number, number];
128+ |export type Coordinates = [
129+ | x: number,
130+ | y: number,
131+ | z: number,
132+ |];
90133 """.trimMargin()
91134 .normalize()
92135 )
0 commit comments