【问题标题】:Unable to Import/Export types from a custom mdule?无法从自定义模块导入/导出类型?
【发布时间】:2021-11-25 00:34:48
【问题描述】:

我正在开发一个打字稿模块(作为更大的 monorepo 的一部分),我似乎无法将类型从一个包导入另一个包(通过节点模块)。我的类型是针对 ./types 构建的,而我的 package.json 是其中的 types: types/index.d.ts 键。无论出于何种原因,在本地开发时,我似乎无法将类型导入另一个模块。

似乎它应该只是工作,并且 npm/typescript 会适当地解决这些问题。

我的 tsconfig 如下所示:

{
    "extends": "../../tsconfig.json",
    "compilerOptions": {
        "baseUrl": "./src",
        "rootDir": "./src",
        "outDir": "./dist",
        "declaration": true,
        "declarationDir": "./types"
    },
    "include": [
        "./src"
    ],
    "exclude": [
        "node_modules",
        "dist"
    ]
}

【问题讨论】:

    标签: typescript npm node-modules typescript-typings


    【解决方案1】:

    用户错误 - 我在项目中重新定义了 global.d.ts 中的库...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-10
      • 2023-01-31
      • 1970-01-01
      • 2012-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多