From 20f5eed114e821a1c2afefe15184bf1cd4e225a4 Mon Sep 17 00:00:00 2001 From: Prince Rajpoot Date: Wed, 4 Oct 2023 02:13:07 +0530 Subject: [PATCH] chore: use optional chain --- examples/csharp-overwrite-enum-naming/index.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/examples/csharp-overwrite-enum-naming/index.ts b/examples/csharp-overwrite-enum-naming/index.ts index dc17450737..4908078d12 100644 --- a/examples/csharp-overwrite-enum-naming/index.ts +++ b/examples/csharp-overwrite-enum-naming/index.ts @@ -1,13 +1,10 @@ import { CSharpGenerator } from '../../src'; -import { DefaultEnumKeyConstraints } from '../../src/generators/csharp/constrainer/EnumConstrainer'; const generator = new CSharpGenerator({ constraints: { enumKey: ({ enumModel, enumKey }) => { // Lets see if an enum has an associated custom name - const hasCustomName = - enumModel.originalInput !== undefined && - enumModel.originalInput['x-enumNames'] !== undefined; + const hasCustomName = enumModel?.originalInput?.['x-enumNames'] !== undefined; if (hasCustomName) { // Lets see if the specific value has an associated name const customName = enumModel.originalInput['x-enumNames'][enumKey];