Property 'fetchPage' does not exist on type.
I use typescript v. 4.5.3, node.js v 14.17.4 and bookshelf + postgres I have this code: export async function getTransactions(userId: number, page: number): Promise { try { let transactions = await new TariffsTransactions() .where({"user_id": userId}) .orderBy("created_at", 'DESC') .fetchPage({ page }); if (transactions){ transactions = (transactions).serialize(); return transactions; } else{ return {}; } } catch (err: any){ return err; } }
and a get error: TS2339: Property 'fetchPage' does not exist on type 'TariffsTransactions'.
It's model:
import bookshelf from '../config/bookshelf';
import Table from '../resources/enums/Table'; import TariffsFunctions from './TariffsFunctions'; import Users from './User';
class TariffsTransactions extends bookshelf.Model { get requireFetch(): boolean { return false; }
get tableName(): string { return Table.TARIFFS_TRANSACTIONS; }
get hasTimestamps(): boolean { return true; } tarrifsFunctions(): any { return this.hasMany(TariffsFunctions, 'id'); } users(): any { return this.hasMany(Users, 'id'); } }
export default TariffsTransactions;
How i can fix this error?
Source: bookshelf/bookshelf