Updating to `apollo-angular@3.0.0` produces `error TS2307: Cannot find module 'apollo-angular/types' or its corresponding type declarations.`
See original GitHub issueDescribe the bug
Release 3.0.0 introduces an undocumented breaking change by moving the import location of types from apollo-angular/types
to apollo-angular/build/types
or apollo-angular/src/types
.
To Reproduce
Update an angular-apollo@2.x.x
project importing types, such as import { QueryOptionsAlone, SubscriptionOptionsAlone, WatchQueryOptionsAlone } from 'apollo-angular/types';
.
Expected behavior The import location should not change or the Migration Guide should specify the new import location.
Environment:
├── @angular/cli@13.2.4
├── UNMET PEER DEPENDENCY @angular/core@13.2.3
├── @apollo/client@3.5.9
├── @types/graphql@14.5.0
├── apollo-angular@3.0.0
├── barrel-maintainer@1.5.3
├── graphql@16.3.0
└── typescript@4.5.5
Additional context Thanks for the new release!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Cannot find module or its corresponding type declarations ...
So my-parser-generator basically offers JavaScript files to a TypeScript consumer. But when I try to import the newly generated parser I get the ......
Read more >TIL: TypeScript | Fix "TS2307: Cannot find module 'src' or its ...
Story After I updated my package.json and installed all ... error TS2307: Cannot find module 'src' or its corresponding type declarations.
Read more >How to import my own module from a test file? - Reddit
"Cannot find module '..' or its corresponding type declarations.ts (2307)". If I ignore the error and run the test, it all works fine...
Read more >typescript-resolvers - GraphQL Code Generator
This plugin generates TypeScript signature for resolve functions of ... GraphQL types, or you can change its behavior be providing custom ...
Read more >error TS2307: Cannot find module 'react' or its corresponding ...
node_modules/@apollo/client/react/context/ApolloConsumer.d.ts:1:19 - error TS2307: Cannot find module 'react' or its corresponding type declarations.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
These sub-packages are fine, these are public as well, take for example
apollo-angular/http
. It’s documented, it’s designed to be used this way.I will create a Pull Request to export
*Alone
options and all these 2nd level types inapollo-angular
.Thanks for your detailed explanations, @kamilkisiela. I see your distinction that the shape of
QueryOptionsAlone
is public but the name and location of the particular typeQueryOptionsAlone
interface is private, or at least less public. As a library producer/maintainer, I can see why you might want to treat it as such. I hope you can appreciate why, as library consumer, I may want such second-level types to be public so I can easily reuse them to annotate my own code. From a consumer perspective, I see a big difference between the second level of parameter and return types and a third level of interior types not directly connected to any public API. Clearly the third level of private objects and their typings unconnected to the public API is none of my business. However, since the second level is tied directly to the public API in typing parameters and return types, I think a reasonable argument can be made for them to be part of the public API (and am curious how much of them not always being treated as such is an artifact of ECMAScript not supporting types natively and TypeScript layering on an optional type system). For what it’s worth, I’m used to importing such second-level typings from other TypeScript libraries, notably those that this one unites,@angular
and@apollo/client
, both of which export parameter and return type typings in their subpackages, though perhaps they are not technically considered public in those libraries, either.