Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-burel committed May 2, 2022
1 parent 6fc85d1 commit ddbc07b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/graphql/server/contextBuilder/utils.ts
Expand Up @@ -22,17 +22,19 @@ const printModelName = (model: VulcanGraphqlModel) =>
* @param model
* @returns
*/
export const getModelDataSource = <TModel extends VulcanDocument>(
context,
export const getModelDataSource = <TDocument extends VulcanDocument>(
context: {
dataSources?: { [dtName: string]: VulcanGenericDataSource<any> };
},
model: VulcanGraphqlModel
): VulcanGenericDataSource => {
): VulcanGenericDataSource<TDocument> => {
if (!context.dataSources)
throw new Error(
"DataSources not set in Apollo. You need to set at least the default dataSources for Vulcan graphql models."
);
const dataSource =
// model.name is the default but we fallback to typeName just in case
context.dataSource[model.name] ||
context.dataSources[model.name] ||
context.dataSources[model.graphql.typeName];
if (!dataSource) {
throw new Error(`${printModelName(model)} have no default dataSource.`);
Expand Down

0 comments on commit ddbc07b

Please sign in to comment.