1

每次尝试构建代码时都会出现此错误,而且我忘记告诉我正在使用纱线工作区,并且我在所有 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 文件

4

0 回答 0