From f8f44c3910f243f8baaab46da66c57db03cc0768 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 01:26:17 +0000 Subject: [PATCH] refactor: use non-null assertions instead of optional chaining for cleaner code Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com> --- packages/openapi-ts-tests/main/test/2.0.x.test.ts | 2 +- packages/openapi-ts-tests/main/test/3.0.x.test.ts | 2 +- packages/openapi-ts-tests/main/test/3.1.x.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/2.0.x.test.ts b/packages/openapi-ts-tests/main/test/2.0.x.test.ts index 916d1645a..088e3f1ae 100644 --- a/packages/openapi-ts-tests/main/test/2.0.x.test.ts +++ b/packages/openapi-ts-tests/main/test/2.0.x.test.ts @@ -300,7 +300,7 @@ describe(`OpenAPI ${version}`, () => { ); // Deduplicate prefixes: Foo_Foo → Foo const m = clean.match(/^([A-Za-z\d]+)_\1([A-Za-z\d]*)$/); - if (m?.[1] && m?.[2] !== undefined) clean = m[1] + m[2]; + if (m) clean = m[1]! + m[2]!; return clean; }, }, diff --git a/packages/openapi-ts-tests/main/test/3.0.x.test.ts b/packages/openapi-ts-tests/main/test/3.0.x.test.ts index b39fcff4e..060e78085 100644 --- a/packages/openapi-ts-tests/main/test/3.0.x.test.ts +++ b/packages/openapi-ts-tests/main/test/3.0.x.test.ts @@ -603,7 +603,7 @@ describe(`OpenAPI ${version}`, () => { ); // Deduplicate prefixes: Foo_Foo → Foo const m = clean.match(/^([A-Za-z\d]+)_\1([A-Za-z\d]*)$/); - if (m?.[1] && m?.[2] !== undefined) clean = m[1] + m[2]; + if (m) clean = m[1]! + m[2]!; return clean; }, }, diff --git a/packages/openapi-ts-tests/main/test/3.1.x.test.ts b/packages/openapi-ts-tests/main/test/3.1.x.test.ts index 2a42d0494..3700992f0 100644 --- a/packages/openapi-ts-tests/main/test/3.1.x.test.ts +++ b/packages/openapi-ts-tests/main/test/3.1.x.test.ts @@ -705,7 +705,7 @@ describe(`OpenAPI ${version}`, () => { ); // Deduplicate prefixes: Foo_Foo → Foo const m = clean.match(/^([A-Za-z\d]+)_\1([A-Za-z\d]*)$/); - if (m?.[1] && m?.[2] !== undefined) clean = m[1] + m[2]; + if (m) clean = m[1]! + m[2]!; return clean; }, }, -- 2.51.2