Home > other >  Type script array push doesn't do anything
Type script array push doesn't do anything

Time:07-28

I'd like to lead off with, this isn't the async issues that other people have posted about where their pushes aren't doing anything. Here is my code

function createHolderPosition(holder: Holder, position: Position): void {
  if(holder.positions == null){
    holder.positions = []
  }
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  const length = holder.positions!.push(position.id);
  log.info("new length {}", [length.toString()])
  log.info("POsition id to add {}", [position.id])
  log.info("POsition {}", [holder.positions!.toString()])
  log.info("POsition {}", [holder.positions![0]])

And here is the output of these log statements

           
  • Related