Skip to content

Commit

Permalink
reduce reliance on nestjs
Browse files Browse the repository at this point in the history
  • Loading branch information
macstr1k3r committed Feb 4, 2023
1 parent c8c483f commit aa7e5f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trpc-nestjs-adapter",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.4",
"description": "TRPC adapter for NestJS",
"keywords": [
"nestjs",
Expand Down
9 changes: 6 additions & 3 deletions src/lib/nest-resolver.type.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import type { ModuleRef } from '@nestjs/core';
/* eslint-disable max-len */
interface Type<T = any> extends Function {
new(...args: any[]): T;
}

export interface NestResolver {
/**
* Resolves any NestJS dependency from your project.
* Resolves any NestJS dependency from your project. a proxy to `moduleRef.get()`
*
* Return type of this function is automatically inferred.
*
* Returns a promise which resolves to the dependency.
*/
resolveNestDependency: ModuleRef['resolve'];
resolveNestDependency: <TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol) => Promise<TResult>;
}
5 changes: 3 additions & 2 deletions src/lib/trpc.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { TrpcModuleOptions } from './trpc-module-options.type';

@Module({})
export class TrpcModule implements OnModuleInit {
@Inject()
private readonly moduleRef!: ModuleRef;
constructor(private moduleRef: ModuleRef) {

}

@Inject()
private readonly httpAdapterHost!: HttpAdapterHost;
Expand Down

0 comments on commit aa7e5f7

Please sign in to comment.