【问题标题】:typescript not inferring types打字稿不推断类型
【发布时间】:2021-09-18 12:01:49
【问题描述】:

我有一个项目,我的 tsconfig.json 似乎缺少一些用于推断类型的配置。

这是我的tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "lib": [
      "dom"
    ],
    "allowJs": true,
    "jsx": "react",
    "declaration": true,
    "declarationMap": true,
    "outDir": "dist",
    "rootDir": "lib",
    "strict": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "exclude": [
    "lib/**/*.spec.tsx",
    "lib/**/*.stories.tsx",
    "lib/settings/*.ts"
  ]
}

我在下面有这个错误:

为了解决,我必须手动导入AnyStyledComponent,如下所示:

我错过了什么?

【问题讨论】:

标签: typescript tsc


【解决方案1】:

我认为你的问题与this有关

【讨论】:

  • 嗨,仅链接的答案不是很有用,因为如果删除了引用的链接,那么答案就消失了。请对此进行扩展。谢谢
猜你喜欢
  • 2018-06-09
  • 2020-04-02
  • 2020-12-20
  • 2016-08-03
  • 2019-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-08-12
相关资源
最近更新 更多