I need help with a TypeScript-related issue. I am struggling to implement the expected return type for the function dataSources in this scenario.
Here is the code snippet:
const dataSources = () => {
quizzessApi: new QuizzessDataSource();
}
const server = new ApolloServer({ typeDefs, resolvers, dataSources });
export default server.createHandler();
While working in VSCode, I encountered the following error:
https://i.sstatic.net/0nZEj.png
After updating with the QuizzesDataSource class:
import { DataSource } from "apollo-datasource";
export interface quizzessInterface {
id: string;
question: string;
correctAnswer: string;
}
export class QuizzessDataSource extends DataSource {
getQuizzess = async (parent, args) => {
const query = `SELECT * FROM c`;
const results = await this.findManyByQuery(
{
query,
},
);
return results.resources;
};
}