I started having an error while trying to use RESTDataSource:
"Class constructor RESTDataSource cannot be invoked without 'new'"
So I tried this solution and added "target": "es2016"
. I don't get the error anymore.
But now I'm getting typescript compilation error
error TS2451: Cannot redeclare block-scoped variable 'Query'.
Apparently this is happening because typescript doesn't recognize my files as modules.
So I tried this solution and added export {}
to my files so they get recognized as modules. But because my target is es2016
I get Unexpected token 'export'
Is there any way I can solve both problems at the same time?
The errors are happening all over my code so I will include the whole repo: https://github.com/grochadc/filex-graphql-server
tsconfig.json
{
"compilerOptions": {
"target": "es2016",
"moduleResolution": "node",
"outDir": "dist/",
"allowSyntheticDefaultImports": true
},
"include": ["src/"],
"exclude": ["node_modules", "**/*.spec.ts"]
}