【问题标题】:Trying to tell TypeScript to ignore node_modules, but it's not working. Can you help me out?试图告诉 TypeScript 忽略 node_modules,但它不起作用。你能帮我吗?
【发布时间】:2021-09-09 16:52:05
【问题描述】:

我的 tsconfig:

{
  "compilerOptions": {
    "esModuleInterop": true,
    "outDir": "dist",
    "rootDir": ".",
    "lib": ["esnext"],
    "strict": true,
    "skipLibCheck": true,
    "types": []
  },
  "include": ["./**/*"],
  "exclude": [
    "node_modules",
    "./node_modules",
    "./node_modules/*",
    "./node_modules/@types/node/index.d.ts",
    "./node_modules/.prisma/*",
    "node_modules/*"
  ]
}

我正在使用tsx 命令编译,它仍然会从node_modules 目录中的文件中打印出很多错误:

[...]
node_modules/.prisma/client/index.d.ts:3907:3 - error TS1135: Argument expression expected.

3907   export class Prisma__TopicClient<T> implements PrismaPromise<T> {
       ~~~~~~

node_modules/.prisma/client/index.d.ts:5660:1 - error TS1128: Declaration or statement expected.

5660 }
     ~


Found 136 errors.

【问题讨论】:

  • 查看answer
  • 我已经将 skipLibCheck 设置为 true(请参阅上面的配置)。

标签: typescript


【解决方案1】:

我建议将您的代码移动到 /src

{
    "include": [
        "src/**/*"
    ],
}

【讨论】:

    猜你喜欢
    • 2015-09-12
    • 2019-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-14
    • 1970-01-01
    • 2022-08-19
    • 2011-10-30
    相关资源
    最近更新 更多