From ac6dcc4abe96b1e8ac7b41878ace61ee7fe893ff Mon Sep 17 00:00:00 2001 From: nicosammito Date: Thu, 23 Apr 2026 23:20:50 +0200 Subject: [PATCH] refactor: improve type safety in getTypeVariant.ts by adding optional chaining for identifier access --- src/extraction/getTypeVariant.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extraction/getTypeVariant.ts b/src/extraction/getTypeVariant.ts index 45bc996..fd74200 100644 --- a/src/extraction/getTypeVariant.ts +++ b/src/extraction/getTypeVariant.ts @@ -32,10 +32,10 @@ export const getTypeVariant = ( const isArrayType = Array.isArray(types); const typesToAnalyze = isArrayType ? (types as DataType[]) : isStringType ? [{ identifier: types, type: types }] : [types]; const identifiers = isArrayType - ? (types as DataType[]).map(t => t.identifier) + ? (types as DataType[]).map(t => t?.identifier) : isStringType ? [types as string] - : [(types as DataType).identifier]; + : [(types as DataType)?.identifier]; const results: TypeVariantResult[] = [];