You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running into the same issue, the issue occurs due to the introspectComments being enabled.
The underlying issue seems to be the following line [1], where jsDoc[0] is undefined whenever there are no comments for a specific property, thus throwing an exception. Just replacing jsDoc[0].comment with jsDoc[0]?.comment will resolve the issue.
Is there an existing issue for this?
Current behavior
We noticed the issue when updating to typescript 5 and updating all our nestJs packages.
Having the plugin set in ./nest-cli.json
And given a class like:
And another class like:
Running
nest start --watch
first. No issues. schema.graphqlModifying any field in the user object, e.g: uncomment the email2 => raise the following issue:
What's happening is that the plugin is not inferring
@Field
on any variable in theToken
class.I dug a bit into what's generating and after the update on the user, the
dist/token/token.entity.js
has the following:instead of:
I tried to figure out if there was something up around:
graphql/packages/graphql/lib/plugin/visitors/model-class.visitor.ts
Line 253 in fb8a582
But I ran out of time before I get anything concrete
Minimum reproduction code
https://github.com/HeroJourneyClub/nestjs_graphql_gen_error
Steps to reproduce
Expected behavior
@field is inferred properly and no error is raised
Package version
11.0.4
Graphql version
graphql
: 16.6.0apollo-server-express
: N/Aapollo-server-fastify
: N/ANestJS version
9.3.12
Node.js version
v16.14.0
In which operating systems have you tested?
Other
Only noticed this issue after upgrading to Typescript 5 and upgrading all our Nestjs package.
rm -rf dist
, then rebuild infer the @field properly, so it seems to be on update.Any file that does not go through:
graphql/packages/graphql/lib/plugin/compiler-plugin.ts
Line 15 in fb8a582
will be having an incorrect
_GRAPHQL_METADATA_FACTORY
in the generated JSThe text was updated successfully, but these errors were encountered: