question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Internal TypeScript errors after 3.4.3 upgrade

See original GitHub issue

Intended outcome: No TypeScript errors in the project.

Actual outcome: After upgrading from @apollo/client v3.3.21 to v3.4.3 our project now reports the following TypeScript errors:

$ ../node_modules/.bin/tsc --noEmit
node_modules/apollo-link/lib/link.d.ts:15:56 - error TS2709: Cannot use namespace 'Observable' as a type.

15     request(operation: Operation, forward?: NextLink): Observable<FetchResult> | null;
                                                          ~~~~~~~~~~

node_modules/apollo-link/lib/link.d.ts:17:79 - error TS2709: Cannot use namespace 'Observable' as a type.

17 export declare function execute(link: ApolloLink, operation: GraphQLRequest): Observable<FetchResult>;
                                                                                 ~~~~~~~~~~

node_modules/apollo-link/lib/linkUtils.d.ts:12:50 - error TS2709: Cannot use namespace 'Observable' as a type.

12 export declare function toPromise<R>(observable: Observable<R>): Promise<R>;
                                                    ~~~~~~~~~~

node_modules/apollo-link/lib/linkUtils.d.ts:14:62 - error TS2709: Cannot use namespace 'Observable' as a type.

14 export declare function fromPromise<T>(promise: Promise<T>): Observable<T>;
                                                                ~~~~~~~~~~

node_modules/apollo-link/lib/linkUtils.d.ts:15:56 - error TS2709: Cannot use namespace 'Observable' as a type.

15 export declare function fromError<T>(errorValue: any): Observable<T>;
                                                          ~~~~~~~~~~

node_modules/apollo-link/lib/types.d.ts:32:58 - error TS2709: Cannot use namespace 'Observable' as a type.

32 export declare type NextLink = (operation: Operation) => Observable<FetchResult>;
                                                            ~~~~~~~~~~

node_modules/apollo-link/lib/types.d.ts:33:83 - error TS2709: Cannot use namespace 'Observable' as a type.

33 export declare type RequestHandler = (operation: Operation, forward: NextLink) => Observable<FetchResult> | null;
                                                                                     ~~~~~~~~~~

How to reproduce the issue: Run ../node_modules/.bin/tsc --noEmit inside a project using @apollo/client v3.4.3

Versions

  System:
    OS: macOS 11.4
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v14.16.0/bin/npm
  Browsers:
    Chrome: 92.0.4515.107
    Firefox: 89.0.2
    Safari: 14.1.1
  npmPackages:
    @apollo/client: 3.4.3 => 3.4.3
    apollo-link-rest: ^0.8.0-beta.0 => 0.8.0-beta.0 
    typescript: 4.3.5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
munivinaykcommented, Sep 15, 2021

Hi i have installed typescript 4.4.2 and resolved this issue.

3reactions
dragosnedelcupicommented, Aug 11, 2021

I can confirm this happened on our side too.

node_modules/@apollo/client/core/types.d.ts:38:1 - error TS1128: Declaration or statement expected.

38 export type { QueryOptions as PureQueryOptions };
   ~~~~~~

node_modules/@apollo/client/core/types.d.ts:38:13 - error TS1005: ';' expected.

38 export type { QueryOptions as PureQueryOptions };
               ~

node_modules/@apollo/client/react/types/types.d.ts:9:1 - error TS1128: Declaration or statement expected.

9 export type { DefaultContext as Context } from "../../core";
  ~~~~~~

node_modules/@apollo/client/react/types/types.d.ts:9:13 - error TS1005: ';' expected.

9 export type { DefaultContext as Context } from "../../core";
              ~

node_modules/@apollo/client/react/types/types.d.ts:9:48 - error TS1005: ';' expected.

9 export type { DefaultContext as Context } from "../../core";
                                                 ~~~~~~~~~~~~

node_modules/@apollo/client/utilities/observables/Observable.d.ts:3:1 - error TS1128: Declaration or statement expected.

3 export type { Observer, ObservableSubscription, Subscriber, };
  ~~~~~~

node_modules/@apollo/client/utilities/observables/Observable.d.ts:3:13 - error TS1005: ';' expected.

3 export type { Observer, ObservableSubscription, Subscriber, };
              ~

node_modules/@apollo/client/utilities/observables/Observable.d.ts:3:61 - error TS1109: Expression expected.

3 export type { Observer, ObservableSubscription, Subscriber, };
                                                              ~

Initially I thought that for some reason node_modules wan’t excluded when running npx tsc --noEmit, unfortunately that is not the case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve compile errors during upgrade of Angular ...
I tried deleting everything inside the node_modules folder and running “npm install”. One thing that is strange is that my current Typescript ......
Read more >
Documentation - TypeScript 3.8
error ! A type-only import can specify a default import or named bindings, but not both. In conjunction with import type , TypeScript...
Read more >
Getting started - Bootstrap
You can also install and manage Bootstrap's Less, CSS, JavaScript, and fonts using Bower: ... More specifically, it includes the following and more:....
Read more >
Highlights - create-react-app - Breword 文档集合
npm install --save --save-exact react-scripts@3.4.3 ... If you're using TypeScript, you will need to upgrade your typescript dependency to 3.7.0 or later if ......
Read more >
Known upgrading issues and solutions - Joomla! Documentation
Backend/Page Break PHP error after upgrade to Joomla 3.5.1 ... In Joomla 3.4.2 and 3.4.3 some JavaScript files were updated which causes an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found