Skip to content
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

Change apollo-angular imports to named non-namespace imports #223

Open
DaSchTour opened this issue Oct 10, 2022 · 8 comments
Open

Change apollo-angular imports to named non-namespace imports #223

DaSchTour opened this issue Oct 10, 2022 · 8 comments

Comments

@DaSchTour
Copy link

Is your feature request related to a problem? Please describe.

Because of this thymikee/jest-preset-angular#963 bug it is not possible to write tests with generated services.

Describe the solution you'd like

Imports for angular-apollo should be changed from import * as Apollo from 'apollo-angular'; to import {Apollo, ...} from 'apollo-angular'

Describe alternatives you've considered

Hacky solutions described in the jest-preset-angular issue, that might have other unknown effects.

@acuevas91
Copy link

Is there any update on this issue? Cause this import breaks unit tests and it is annoying... thanks!

@joepvl
Copy link

joepvl commented Nov 21, 2022

It's probably worth noting that the typescript-apollo-angular plugin was moved to dotanshima/graphql-code-generator-community.

@acuevas91
Copy link

But I have seen that the main issues board refers to this repository, do you think we should create this issue in the board you mention? @joepvl

@joepvl
Copy link

joepvl commented Nov 21, 2022

That would be my guess, as relevant PRs would also be in that repo. In any case, I wouldn't hold my breath for this being implemented by the maintainers. I worked around the issue myself by using the afterOneFileWrite hook to rewrite some of the generated code. It's not exactly pretty though.

@acuevas91
Copy link

@joepvl perfect, many thanks for your response! I did not know about this hook, I will take a look!

@gsingh-ut
Copy link

gsingh-ut commented Dec 2, 2022

I am running into the exact same problem described above.
@acuevas91 Did you end up opening an issue on dotanshima/graphql-code-generator-community ?

@acuevas91
Copy link

Nop I did not have time to do it. If so, I will posted it here

@gsingh-ut
Copy link

Nop I did not have time to do it. If so, I will posted it here

Thanks for the update. In that case, I will create one and link it here 😄

@dotansimha dotansimha transferred this issue from dotansimha/graphql-code-generator Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants