nestjs / graphql

GraphQL (TypeScript) module for Nest framework (node.js) 🍷
https://docs.nestjs.com/graphql/quick-start
MIT License
1.46k stars 396 forks source link

Abstract interfaces cannot be found #2373

Closed dalopez24 closed 2 years ago

dalopez24 commented 2 years ago

Is there an existing issue for this?

Current behavior

Following the course nestjs/graphql I encounter this situation which is blocking me and I think this is a problem from the framework, I created an entity with its module everything is fine, but at the moment I created an interface to use with my coffee entity ( ObjectType ) the compiler throws an error saying he doesn't find the file for the interface. The funny thing here is, that if I declare the interface inside the same file ( coffee.entity.ts ) it works just fine.

OLD DESCRIPTION

When creating an interface with the latest versions of nestjs, I got an error Cannot find module 'src/common/interfaces/drink.interface', only when I create the interface in a separate file when it's included in the same model or entity file the compiler doesn't fail. Currently, I'm following the nestjs/graphql code first approach.

END OLD DESCRIPTION

Minimum reproduction code

https://gist.github.com/dalopez24/c0a868f3728d445751c4499389b294ce

https://stackblitz.com/edit/nestjs-typescript-starter-afmp8a?file=src/main.ts

Steps to reproduce

No response

Expected behavior

Creating an interface outside of the entity and reusing it should be possible without any trouble.

Package version

10.0.22

Graphql version

graphql: ^16.6.0 apollo-server-express: ^3.10.2 apollo-server-fastify: none

NestJS version

^9.0.0

Node.js version

v16.15.0

In which operating systems have you tested?

Other

No response

kamilmysliwiec commented 2 years ago

Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).

dalopez24 commented 2 years ago

Hi @kamilmysliwiec I updated the description and also added a link to StackBlitz

dalopez24 commented 2 years ago

A relative path just worked fine...