New to ts and not sure how to resolve this. When running tsc I am getting compilation errors from type-graphql and apollo-server-core. This doesn't make sense to me as they come with types and type-graphql is literally meant to be used with typescript. Please help me figure this one out, added everything I could find online to my tsconfig to no avail.
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": ["es5", "es6", "es2017", "dom", "esnext.asynciterable"],
"skipLibCheck": true,
"sourceMap": true,
"outDir": "./dist",
"moduleResolution": "node",
"removeComments": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"resolveJsonModule": true
},
"exclude": ["./node_modules", "./node_modules/**/*"],
"include": ["./src/**/*.tsx", "./src/**/*.ts"]
}
and the package.json
{
"name": "kp-api",
"version": "1.0.0",
"description": "ketopal api app",
"main": "index.js",
"license": "NONE",
"private": true,
"devDependencies": {
"@types/express": "^4.17.11",
"@types/node": "^8.0.29",
"nodemon": "^2.0.7",
"typescript": "3.3.3333"
},
"dependencies": {
"apollo-server-express": "^2.23.0",
"express": "^4.17.1",
"graphql": "^15.5.0",
"pg": "^8.4.0",
"reflect-metadata": "^0.1.10",
"type-graphql": "^1.1.1",
"typeorm": "0.2.32"
},
"scripts": {
"build": "tsc",
"dev": "nodemon dist/index.js",
"start": "rm -rf dist; yarn tsc; node dist/index.js",
"watch": "tsc -w"
}
}
Edit: To answer the first comment, the errors all look like
yarn run v1.22.10
$ tsc
node_modules/type-graphql/dist/decorators/unions.d.ts:4:63 - error TS1005: ',' expected.
4 export interface UnionTypeConfig<TClassTypes extends readonly ClassType[]> extends ResolveTypeOptions<UnionFromClasses<TClassTypes>> {
~~~~~~~~~
node_modules/type-graphql/dist/decorators/unions.d.ts:4:72 - error TS1005: ',' expected.
4 export interface UnionTypeConfig<TClassTypes extends readonly ClassType[]> extends ResolveTypeOptions<UnionFromClasses<TClassTypes>> {
...
npx ts-node src/index.ts
doesn't throw any errors. I am so confused.