Intended outcome:
Using create-react-app-typescript + installing Apollo Boost, typescript definitions are automatically included.
Actual outcome:
Cannot use 'new' with an expression whose type lacks a call or construct signature.
How to reproduce the issue:
npm install -g create-react-app
create-react-app client --scripts-version=react-scripts-ts
Follow https://www.apollographql.com/docs/react/essentials/get-started.html
Versions
System:
OS: macOS High Sierra 10.13.5
Binaries:
Node: 10.5.0 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.1.0 - /usr/local/bin/npm
Browsers:
Firefox: 57.0.4
Safari: 11.1.1
npmPackages:
apollo-boost: ^0.1.10 => 0.1.10
react-apollo: ^2.1.9 => 2.1.9
Issue Labels
Hey!
I was doing it incorrectly. Usually when importing from JS to TS modules, instead of
import ApolloClient from "apollo-boost";
import gql from "graphql-tag";
It is required to write
import * as ApolloClient from "apollo-boost";
import * as gql from "graphql-tag";
This case the syntax is same as in JS for imports, and everything works fine.
Have a nice day!
Most helpful comment
Hey!
I was doing it incorrectly. Usually when importing from JS to TS modules, instead of
It is required to write
This case the syntax is same as in JS for imports, and everything works fine.
Have a nice day!