From 9116345b02d49b6d5f056d97b021cf66d943fb43 Mon Sep 17 00:00:00 2001 From: Nik Gilmore Date: Wed, 28 Jan 2026 15:59:51 -0800 Subject: [PATCH] Remove unnecessary type logic to use returned enum --- .../src/vault/models/view/cipher.view.ts | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/libs/common/src/vault/models/view/cipher.view.ts b/libs/common/src/vault/models/view/cipher.view.ts index 1c3a1da2f70..878181fa1cc 100644 --- a/libs/common/src/vault/models/view/cipher.view.ts +++ b/libs/common/src/vault/models/view/cipher.view.ts @@ -286,27 +286,7 @@ export class CipherView implements View, InitializerMetadata { cipherView.folderId = uuidAsString(obj.folderId); cipherView.name = obj.name; cipherView.notes = obj.notes; - - // SDK returns type as a discriminated union object, extract the actual CipherType - const sdkType: CipherViewType | CipherType = (obj.type as any) ?? CipherType.Login; - - // Handle both discriminated union format and numeric CipherType - if (typeof sdkType === "number") { - cipherView.type = sdkType; - } else if (typeof sdkType === "object" && sdkType !== null) { - if ("login" in sdkType) { - cipherView.type = CipherType.Login; - } else if ("card" in sdkType) { - cipherView.type = CipherType.Card; - } else if ("identity" in sdkType) { - cipherView.type = CipherType.Identity; - } else if ("secureNote" in sdkType) { - cipherView.type = CipherType.SecureNote; - } else if ("sshKey" in sdkType) { - cipherView.type = CipherType.SshKey; - } - } - + cipherView.type = obj.type ?? CipherType.Login; cipherView.favorite = obj.favorite; cipherView.organizationUseTotp = obj.organizationUseTotp; cipherView.permissions = obj.permissions