Skip to content

Commit

Permalink
fix: make dataLoaderOptionsToken a const
Browse files Browse the repository at this point in the history
  • Loading branch information
Silas Rosenkranz committed Apr 27, 2023
1 parent feae58d commit d6cb3ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/query-graphql/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface NestjsQueryGraphqlModuleFeatureOpts {
@Module({})
export class NestjsQueryGraphQLCoreModule {
public static forRoot(opts: NestjsQueryGraphqlModuleRootOpts): DynamicModule {
const providers = [{ provide: dataLoaderOptionsToken(), useValue: opts.dataLoader ?? {} }]
const providers = [{ provide: dataLoaderOptionsToken, useValue: opts.dataLoader ?? {} }]

return {
module: NestjsQueryGraphQLCoreModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Inject, Injectable, PipeTransform } from '@nestjs/common'
import { ModuleRef } from '@nestjs/core'
import { Options } from 'dataloader'

export const dataLoaderOptionsToken = () => 'DATALOADER_OPTIONS'
export const dataLoaderOptionsToken = 'DATALOADER_OPTIONS' as const;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type DataLoaderOptions = Options<any, any, any>

Expand All @@ -15,7 +15,7 @@ export class InjectDataLoaderConfigPipe implements PipeTransform {
private moduleRef: ModuleRef
) {
try {
this.options = this.moduleRef.get(dataLoaderOptionsToken(), { strict: false })
this.options = this.moduleRef.get(dataLoaderOptionsToken, { strict: false })
} catch (error) {
//
}
Expand Down

0 comments on commit d6cb3ab

Please sign in to comment.