apollo-client: Bug on build with mergeDeep
Intended outcome:
Here are version of packages that I’m using:
"apollo-angular": "1.0.1",
"apollo-angular-link-http": "1.0.1",
"apollo-cache-inmemory": "1.3.9",
"apollo-client": "2.4.5",
"apollo-link": "1.2.3",
"apollo-link-context": "1.0.9",
"apollo-link-http": "1.5.5",
Actual outcome:
Running ng build produces
node_modules/apollo-utilities/lib/util/mergeDeep.d.ts(1,214): error TS1005: ',' expected.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 20 (6 by maintainers)
+1
Wanted to share my observations in case it assists others. A little back story: we have a large enterprise application codebase that was working, but seemingly breaks following running an ‘npm install’ - error is the reported deepMerge. We can’t currently migrate to Angular 7, and Angular 6 of course doesn’t support TypeScript 3… So we find ourselves having to find a workaround until we can tackle migration - which is unfortunate. I am sharing this in case it assists others to avoid wasting 2 days.
Our project’s relevant dependencies from package.json:
Our project’s relevant dev dependencies from package.json:
Node/NPM:
I’ve found two workarounds that get us building, though we have yet to do the testing that will be needed to vet if this is actually a workable solution (e.g. everything behaving at runtime)… In any case, either of the following will get us building again:
As mentioned, performing either of the above in our codebase results in a working build.
As mentioned, I’ve tracked down 3 versions of apollo-utilities at play within the various nested node_modules: 1.2.1, 1.0.22, 1.1.2.
For the interested, here is what I am seeing when I inspect the package-lock.json following npm install:
@benjamn I’m seeing this error with typescript v3.3.3333.
Edit: Actually, I’m using Typescript v3.3.3333, but a package has a dependency instead of a peer dependency, pinning the version at 2.2. So it’s not actually running Typescript 3 for me:
https://github.com/prisma/serverless-plugin-typescript/blob/master/package.json
So, ignore this, it’s not actually happening in v3.
Upgrading Angular and typescript worked for me!! 😃
“@angular/core”: “6.1.10”, “@angular/cli”: “6.2.5”, “apollo-utilities”: “1.0.21”, “typescript”: “2.8.4”
Folks, please read the existing comments before posting the same information again. Updating
typescript
to version 3.0.0 or higher has fixed this problem for others. If that’s not an option, I’d like to understand what’s holding you back, so that we can weigh our options. Commenting that you have the same problem is not helpful at this point. Thanks.If you’re not able to update
typescript
, you might be able to disable type checking forapollo-utilities
specifically, ornode_modules
in general. I’m not sure exactly how that would work in an Angular project, but it seems like it should be feasible.