每次尝试构建代码时,都会出现此错误,而且我也忘了告诉我正在使用yarn工作区,并且在所有tsconfig中都排除了node_modules
实际错误:
$ rimraf ./dist && tsc
../../node_modules/graphql-toolkit/dist/esnext/utils/validate-documents.d.ts:7:115 - error TS1005: ',' expected.
7 export declare const validateGraphQlDocuments: (schema: GraphQLSchema, documentFiles: DocumentFile[]) => readonly LoadDocumentError[];
~~~~~~~~~~~~~~~~~
../../node_modules/graphql-toolkit/dist/esnext/utils/validate-documents.d.ts:7:132 - error TS1005: ',' expected.
7 export declare const validateGraphQlDocuments: (schema: GraphQLSchema, documentFiles: DocumentFile[]) => readonly LoadDocumentError[];
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
即使我排除了node_modules和skipLibCheck,我也无法使它工作:true但似乎无济于事
我的tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": ["dom", "es6", "es2017", "esnext", "esnext.asynciterable"],
"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": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true
},
"exclude": ["node_modules"],
"include": ["./src/**/*.tsx", "./src/**/*.ts"]
}
我要编译时没有错误,并排除node_modules中的.d.ts文件