Typescript 类型脚本解析嵌套路径

Typescript 类型脚本解析嵌套路径,typescript,Typescript,我试图在嵌套的tsconfig.json中解析多个路径,但是我得到: packages/foo/src/components/Foo/Foo.tsx:3:21 - error TS2307: Cannot find module '@services/foo' or its corresponding type declarations. 如何使路径在嵌套配置中工作 我有一个这样的项目: tsconfig.json src/packages/foo/tsconfig.json src/pack

我试图在嵌套的
tsconfig.json
中解析多个
路径
,但是我得到:

packages/foo/src/components/Foo/Foo.tsx:3:21 - error TS2307: Cannot find module '@services/foo' or its corresponding type declarations.
如何使路径在嵌套配置中工作

我有一个这样的项目:

tsconfig.json
src/packages/foo/tsconfig.json
src/packages/bar/tsconfig.json
在每个包中,tsconfig.json看起来都是这样,请注意路径配置:

{
  "compilerOptions": {
    "allowJs": true,
    "isolatedModules": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "declarationDir": "dist",
    "declaration": true,
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "react",
    "baseUrl": "./src",
    "paths": {
      "@services/*": ["services/*"]
    }
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules",
    "dist"
  ]
}
这是根
tsconfig.json

{
  "compilerOptions": {
    "allowJs": true,
    "isolatedModules": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "strict": true,
    "jsx": "react",
    "noEmit": true
  },
  "include": [
    "packages/**/*"
  ],
  "exclude": [
    "node_modules",
    "dist"
  ]
}

我希望在根目录下运行
tsc
,当编译器遇到嵌套的
tsconfig.json
时,它“加载”路径别名。

听起来像是我的repo,它使用了路径映射,但工作正常