You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
tyazhelomov
changed the title
Property 'fetchPage' does not exist on type 'TariffsTransactions'.
Property 'fetchPage' does not exist on type.
Dec 16, 2021
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?
The text was updated successfully, but these errors were encountered: