Closed adampetrie closed 6 years ago
What target do you have specified in your tsconfig.json
? If you're transpiling to ES5, extending native classes may not work. With modern versions of Node, a target of es2016
(for Node 6) or even higher should be ok.
Thanks for the tip. I've updated my tsconfig.json
to the following:
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"strict": false,
"outDir": "dist",
"sourceMap": true,
"noImplicitAny": true,
"jsx": "react",
"skipLibCheck": true
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*"]
}
But I'm still getting the same error.
Hmmm, that is really surprising. Is there any chance you're transpiling the resulting JavaScript further with Babel? Or else maybe you could try to clean your output directory and recompile?
Looks like I had some caching issues that we're preventing the change from taking affect. Thanks for your help!
If my compiler is targeting es5 and I'm unable to change it for other reasons, how would go about integrating a REST data source into my Apollo server?
Looks like I had some caching issues that we're preventing the change from taking affect. Thanks for your help!
@adampetrie how did you manage to solve it, what cashing issues?
Im new to Apollo and GraphQL and Im trying to get a basic server up and running in Typescript however whenever I try to query my local playground I get the following error response:
Class constructor RESTDataSource cannot be invoked without 'new'
I've followed the docs and have setup my server as follows:
and
Can anyone offer some insight? Thanks