code: function castNumberToString(pageNumber?: number | string): string {
    if (typeof pageNumber === 'number') {
      return String(pageNumber);
    }
  
    if (typeof pageNumber === 'string') {
      return pageNumber;
    }
  
    if (
      typeof pageNumber !== 'string' ||
      typeof pageNumber !== 'number'
    ) {
      throw new Error('Unexpected page number type');
    }
  
    throw new Error(`Unable to cast ${pageNumber} to string`);
  }
docs: Helper method for parsing page numbers