Skip to content

Commit

Permalink
chore: replace casts with not-null assertions (solana-labs#27883)
Browse files Browse the repository at this point in the history
  • Loading branch information
macalinao authored and gnapoli23 committed Dec 16, 2022
1 parent 27af8de commit 00838f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions web3.js/src/message/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 = [];
Expand All @@ -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);
Expand Down

0 comments on commit 00838f2

Please sign in to comment.