-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.27.1: fields with undefined values present in args of generated types #434
Comments
@MichalLytek here's the package.json with all the versions used in my repro
but i can also repro with |
@MichalLytek it does seem the test snapshots were updated to expect all these undefined values in this commit |
So this is related to |
@MichalLytek i believe this may be due to changing the generator's target to i've been playing around locally, and changing that one line creates these two different class definitions in the emitted js: es2019
es2022
If I understand correctly, before ES2022, classes had to define properties in the constructor, but since the generated classes in type-graphql don't have constructors, they don't get initialized just by creating an instance of the class (and therefore don't exist unless typegraphql core sets a value for them? guessing here) |
Closing as fixed by 4c053cc |
Thank you @MichalLytek ! Much appreciated. |
Describe the Bug
When using:
[email protected]
AND
emitTranspiledCode = true
to reproduce)then
Args()
will have ALL keys present when deserialized, even those which the request didn't specify -- those which weren't specified in the request will be present withundefined
valuesExample:
link
args will be:
To Reproduce
git clone https://github.com/shawnjones253/typegraphql-prisma
open localhost:4000 in web browser
send this gql query:
Expected Behavior
args SHOULD be:
this was the behavior with 0.27.0, you can verify this with
npm install -D -E [email protected]
and rerunning the repro above
Environment (please complete the following information):
typegraphql-prisma
version 0.27.1Additional Context
I tried to workaround this by using
emitGeneratedCode = false
(this fixes it in the example repo) -- but in my actual project, I ran into tons ofReferenceError: Cannot access '....' before initialization
despite using all the tsconfig options from hereThe text was updated successfully, but these errors were encountered: