Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'fetchPage' does not exist on type. #2118

Open
tyazhelomov opened this issue Dec 16, 2021 · 0 comments
Open

Property 'fetchPage' does not exist on type. #2118

tyazhelomov opened this issue Dec 16, 2021 · 0 comments

Comments

@tyazhelomov
Copy link

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?

@tyazhelomov tyazhelomov changed the title Property 'fetchPage' does not exist on type 'TariffsTransactions'. Property 'fetchPage' does not exist on type. Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant