From a041e95cc268a73becc0e6665ebe5ca10219647a Mon Sep 17 00:00:00 2001 From: Lars Melchior Date: Wed, 28 Aug 2024 17:11:07 +0200 Subject: [PATCH] avoid has collisions --- src/newHelperTypeName.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/newHelperTypeName.ts b/src/newHelperTypeName.ts index 2fc5670..42656ed 100644 --- a/src/newHelperTypeName.ts +++ b/src/newHelperTypeName.ts @@ -13,6 +13,8 @@ export const newHelperTypeName = (state: ParserState, type: ts.Type) => { let shortHash = fullHash.digest("base64").replace(/\W/g, '').substring(0, 10); if (state.helperTypeNames.has(shortHash) && state.helperTypeNames.get(shortHash) !== type) { shortHash = "HelperType" + state.helperTypeNames.size.toString(); + } else { + state.helperTypeNames.set(shortHash, type); } return `Ts2Py_${shortHash}`; };