From 19ec2dc0b176f60bdca8c98a7260ccbfc4e79267 Mon Sep 17 00:00:00 2001 From: Ian Macalinao Date: Tue, 29 Nov 2022 01:26:08 -0600 Subject: [PATCH] chore: replace casts with not-null assertions (#27883) --- web3.js/src/message/legacy.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web3.js/src/message/legacy.ts b/web3.js/src/message/legacy.ts index 6dec8ac62a..98b9500354 100644 --- a/web3.js/src/message/legacy.ts +++ b/web3.js/src/message/legacy.ts @@ -268,7 +268,7 @@ export class Message { // Slice up wire data let byteArray = [...buffer]; - const numRequiredSignatures = byteArray.shift() as number; + const numRequiredSignatures = byteArray.shift()!; if ( numRequiredSignatures !== (numRequiredSignatures & VERSION_PREFIX_MASK) @@ -278,8 +278,8 @@ export class Message { ); } - const numReadonlySignedAccounts = byteArray.shift() as number; - const numReadonlyUnsignedAccounts = byteArray.shift() as number; + const numReadonlySignedAccounts = byteArray.shift()!; + const numReadonlyUnsignedAccounts = byteArray.shift()!; const accountCount = shortvec.decodeLength(byteArray); let accountKeys = []; @@ -295,7 +295,7 @@ export class Message { const instructionCount = shortvec.decodeLength(byteArray); let instructions: CompiledInstruction[] = []; for (let i = 0; i < instructionCount; i++) { - const programIdIndex = byteArray.shift() as number; + const programIdIndex = byteArray.shift()!; const accountCount = shortvec.decodeLength(byteArray); const accounts = byteArray.slice(0, accountCount); byteArray = byteArray.slice(accountCount);