Skip to content

Commit

Permalink
Relocate type assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
OGPoyraz committed Jun 24, 2024
1 parent d9fc14d commit 2ebe685
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/utils/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ type SignTypedMessageDataV3V4 = {
export function normalizeTypedMessage(messageData: string) {
let data;
try {
data = parseTypedMessage(
messageData,
) as unknown as SignTypedMessageDataV3V4;
data = parseTypedMessage(messageData);
} catch (e) {
// Ignore normalization errors and pass the message as is
return messageData;
Expand Down Expand Up @@ -53,7 +51,7 @@ function parseTypedMessage(data: string) {
}

try {
return JSON.parse(data);
return JSON.parse(data) as unknown as SignTypedMessageDataV3V4;
} catch (e) {
throw new Error(`Invalid message data for normalization. data: ${data}`);
}
Expand Down

0 comments on commit 2ebe685

Please sign in to comment.