Skip to content

TypeError: Object(...) is not a function #57

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
hoodsy opened this issue Jan 20, 2018 · 9 comments
Closed

TypeError: Object(...) is not a function #57

hoodsy opened this issue Jan 20, 2018 · 9 comments

Comments

@hoodsy
Copy link

hoodsy commented Jan 20, 2018

When trying to import createUploadLink, throws the error: TypeError: Object(...) is not a function in 7.0.0-alpha.3.

import { createUploadLink } from 'apollo-upload-client'
@jaydenseric
Copy link
Owner

See #56 (comment), #43 (comment) and #35 (comment). Does updating create-react-app solve the issue?

@hoodsy
Copy link
Author

hoodsy commented Jan 21, 2018

Yes! sorry, didn't see those. Thanks.

@hoodsy hoodsy closed this as completed Jan 21, 2018
@jaydenseric
Copy link
Owner

Awesome, glad it was an easy fix 😊

@vladinator1000
Copy link

vladinator1000 commented Feb 17, 2018

This doesn't work with react-create-app-typescript. They've merged .mjs support, still nada for me.

To reproduce:

npm install -g create-react-app
create-react-app my-app --scripts-version=react-scripts-ts
cd my-app/

Create a types.d.ts file in the src with the following content:

declare module 'apollo-upload-client';

Add this to index.tsx:

import { createUploadLink } from 'apollo-upload-client';
export const uploadLink = createUploadLink({ uri: `/manage` });

@jaydenseric
Copy link
Owner

@savovs are you sure the .mjs support has made its way into that TypeScript fork?

screen shot 2018-02-17 at 2 34 47 pm

@vladinator1000
Copy link

Whoops, looks like they might be behind. Sometimes I wish I stuck with JS... 😀

@saidelghamri
Copy link

check the version of @angular/cdk&material in your package.json if you see a version above 5.2.4 and you're using angular 5 try to downgrade it using those commandes
=> npm uninstall @angular/material --save
then
=> npm install @angular/material@5.2.4 --save
and for CDK use :
=> npm uninstall @angular/cdk --save
then
=> npm install @angular/cdk@5.2.4 --save

hope it work for you :)

@papajo
Copy link

papajo commented Nov 20, 2018

TypeError: Object(...) is not a function
What is the solution for this? I am getting the same error also. I am using pure ReactJS environment bootstrapped with create-react-app, none of the angularjs or apollo stuff. tia.

@someoneinatree
Copy link

I got this issue. Was trying to use hooks on a non-hooky react version. All good now (npm install react{,-dom}@latest)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants